spmviz.data.find_occurrence#

spmviz.data.find_occurrence(sequence, pattern, constraints=None, times=None, start=0, **kw)[source]#

Element indices of the earliest-ending occurrence of a pattern, or None.

Parameters:
sequencesequence of itemsets
patternpattern
constraintsConstraints, optional

Or the keywords min_gap, max_gap, max_span, gap_unit.

timessequence of float, optional

Timestamps of the elements, required when gap_unit="time".

startint

First element index that may be matched.

Examples

>>> find_occurrence(["a", "b", "x", "c"], "a c")
[0, 3]
>>> find_occurrence(["a", "b", "x", "c"], "a c", max_gap=2) is None
True