pm4py.stats.get_all_case_durations#

pm4py.stats.get_all_case_durations(log: EventLog | DataFrame, business_hours: bool = False, business_hour_slots=[(25200, 61200), (111600, 147600), (198000, 234000), (284400, 320400), (370800, 406800)], activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') List[float][source]#

Retrieves the durations of all cases in the event log.

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

  • business_hours (bool) – If True, computes durations based on business hours; otherwise, uses calendar time.

  • business_hour_slots

    Work schedule of the company as a list of tuples. Each tuple represents a time slot in seconds since the week start. Example: [

    (7 * 60 * 60, 17 * 60 * 60), ((24 + 7) * 60 * 60, (24 + 12) * 60 * 60), ((24 + 13) * 60 * 60, (24 + 17) * 60 * 60),

    ] This example means: - Monday 07:00 - 17:00 - Tuesday 07:00 - 12:00 - Tuesday 13:00 - 17:00

  • 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 sorted list of case durations.

import pm4py

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