pm4py.filtering.filter_paths_performance#

pm4py.filtering.filter_paths_performance(log: EventLog | DataFrame, path: Tuple[str, str], min_performance: float, max_performance: float, keep: bool = True, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') EventLog | DataFrame[source]#

Filters the event log based on the performance of specified paths.

  • If keep=True, retains cases having the specified path (tuple of 2 activities) with a duration between min_performance and max_performance.

  • If keep=False, discards cases having the specified path with a duration between min_performance and max_performance.

Parameters:
  • log – Event log or Pandas DataFrame.

  • path – Tuple of two activities (source_activity, target_activity).

  • min_performance (float) – Minimum allowed performance of the path.

  • max_performance (float) – Maximum allowed performance of the path.

  • keep (bool) – Boolean indicating whether to keep (if True) or discard (if False) the cases with the specified performance.

  • 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.

Returns:

Filtered event log or Pandas DataFrame.

import pm4py

filtered_dataframe = pm4py.filter_paths_performance(
    dataframe,
    ('A', 'D'),
    3600.0,
    86400.0,
    activity_key='concept:name',
    timestamp_key='time:timestamp',
    case_id_key='case:concept:name'
)