pm4py.filtering.filter_activities_rework(log: Union[EventLog, DataFrame], activity: str, min_occurrences: int = 2, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Union[EventLog, DataFrame][source]#

Filters the event log, keeping the cases where the specified activity occurs at least min_occurrences times.

  • log – event log / Pandas dataframe

  • activity (str) – activity

  • min_occurrences (int) – minimum desidered number of occurrences

  • 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 case identifier

Return type:

Union[EventLog, pd.DataFrame]

import pm4py

filtered_dataframe = pm4py.filter_activities_rework(dataframe, 'Approve Order', 2, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name')