SequenceMap

class SequenceMap(codes=None, name='')[source]

A map of unique sequences of column values of a particular length appear in a columnar file.

name

An optional name of this remap for identification purposes.

Type:

str

Notes: This mapping converts all columns in the mapping to strings. The remapping does not support other types of columns.

Methods

SequenceMap.__init__([codes, name])

Information for setting up the maps.

SequenceMap.dot_str([group_spec])

Produce a DOT string representing this sequence map.

SequenceMap.edge_to_str(key)

Convert a graph edge to a DOT string.

SequenceMap.filter_edges()

SequenceMap.get_edge_list([sort])

Return a DOT format edge list with the option of sorting by edge counts.

SequenceMap.prep(data)

Remove quotes from the specified columns and convert to string.

SequenceMap.update(data)

Update the existing map with information from data.

Attributes

SequenceMap.__init__(codes=None, name='')[source]

Information for setting up the maps.

Parameters:
  • codes (list or None) – If None use all codes, otherwise only include listed codes in the map.

  • name (str) – Name associated with this remap (usually a pathname of the events file).

SequenceMap.dot_str(group_spec={})[source]

Produce a DOT string representing this sequence map.

SequenceMap.edge_to_str(key)[source]

Convert a graph edge to a DOT string.

Parameters:

key (str) – Hashcode string representing a graph edge.

SequenceMap.filter_edges()[source]
SequenceMap.get_edge_list(sort=True)[source]

Return a DOT format edge list with the option of sorting by edge counts.

Parameters:

sort (bool) – If True (the default), the edge list is sorted by edge counts.

Returns:

list of DOT strings representing the edges labeled by counts.

Return type:

list

static SequenceMap.prep(data)[source]

Remove quotes from the specified columns and convert to string.

Parameters:

data (Series) – Dataframe to process by removing quotes.

Returns: Series .. rubric:: Notes

  • Replacement is done in place.

SequenceMap.update(data)[source]

Update the existing map with information from data.

Parameters:
  • data (Series) – DataFrame or filename of an events file or event map.

  • allow_missing (bool) – If True allow missing keys and add as n/a columns.

Raises:

HedFileError

  • If there are missing keys and allow_missing is False.