pm4py.stats.get_service_time#
- pm4py.stats.get_service_time(log: EventLog | DataFrame, aggregation_measure: str = 'mean', activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', start_timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Dict[str, float] [source]#
Computes the service time for each activity in the event log using the specified aggregation measure.
Service time refers to the duration an activity takes within a case.
- Parameters:
log – Event log (EventLog or pandas DataFrame).
aggregation_measure (
str
) – Aggregation function to apply (e.g., “mean”, “median”, “min”, “max”, “sum”).activity_key (
str
) – Attribute to be used for the activity.timestamp_key (
str
) – Attribute to be used for the timestamp.start_timestamp_key (
str
) – Attribute to be used for the start timestamp.case_id_key (
str
) – Attribute to be used as the case identifier.
- Returns:
A dictionary mapping each activity to its aggregated service time.
import pm4py log = pm4py.read_xes('tests/input_data/interval_event_log.xes') mean_serv_time = pm4py.get_service_time( log, start_timestamp_key='start_timestamp', aggregation_measure='mean' ) print(mean_serv_time) median_serv_time = pm4py.get_service_time( log, start_timestamp_key='start_timestamp', aggregation_measure='median' ) print(median_serv_time)