pm4py.stats.get_activity_position_summary#
- pm4py.stats.get_activity_position_summary(log: EventLog | DataFrame, activity: str, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Dict[int, int] [source]#
Summarizes the positions of a specific activity across all cases in the event log.
For each occurrence of the activity, records its position within the trace. For example, if ‘A’ occurs 1000 times in position 1 and 500 times in position 2, the returned dictionary will be {1: 1000, 2: 500}.
- Parameters:
log – Event log object (EventLog or pandas DataFrame).
activity (
str
) – The activity to analyze.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.
- Returns:
A dictionary mapping positions (0-based index) to the number of times the activity occurs in that position.
import pm4py act_pos = pm4py.get_activity_position_summary( dataframe, 'Act. A', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp' )