pm4py.stats.get_variants_as_tuples#

pm4py.stats.get_variants_as_tuples(log: EventLog | DataFrame, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name', max_repetitions: int = 9223372036854775807) Dict[Tuple[str], List[Trace]] | Dict[Tuple[str], int][source]#

Retrieves the variants from the log, where the variant keys are tuples.

Parameters:
  • log – Event log (EventLog or pandas DataFrame).

  • activity_key (str) – Attribute to be used for the activity.

  • timestamp_key (str) – Attribute to be used for the timestamp.

  • case_id_key (str) – Attribute to be used as the case identifier.

  • max_repetitions (int) – Maximum number of consecutive repetitions for an activity. Reduces variants by limiting consecutive activity repetitions.

Returns:

A dictionary mapping activity tuples to their counts or lists of traces.

import pm4py

variants = pm4py.get_variants_as_tuples(
    dataframe,
    activity_key='concept:name',
    case_id_key='case:concept:name',
    timestamp_key='time:timestamp'
)