pm4py.algo.transformation.trace_encodings.variants.temporal module#
PM4Py – A Process Mining Library for Python Copyright (C) 2026 Process Intelligence Solutions GmbH
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
- class pm4py.algo.transformation.trace_encodings.variants.temporal.Parameters(*values)[source]#
Bases:
Enum- ARRIVAL_RATE = 'arrival_rate'#
- FINISH_RATE = 'finish_rate'#
- CASE_ID_COLUMN = 'pm4py:param:case_id_key'#
- START_TIMESTAMP_COLUMN = 'pm4py:param:start_timestamp_key'#
- TIMESTAMP_COLUMN = 'pm4py:param:timestamp_key'#
- RESOURCE_COLUMN = 'pm4py:param:resource_key'#
- ACTIVITY_COLUMN = 'pm4py:param:activity_key'#
- GROUPER_FREQ = 'grouper_freq'#
- SERVICE_TIME = 'service_time'#
- WAITING_TIME = 'waiting_time'#
- SOJOURN_TIME = 'sojourn_time'#
- DIFF_START_END = 'diff_start_end'#
- pm4py.algo.transformation.trace_encodings.variants.temporal.apply(log: EventLog | EventStream | DataFrame, parameters: Dict[Any, Any] | None = None) DataFrame[source]#
Aggregates an event log into temporal windows and computes window-level process features.
From an event-log point of view, events are grouped by a timestamp frequency such as weekly (“W”) or daily (“D”). Each output row describes one time window, not one trace. The columns include counts and averages such as unique resources, unique activities, number of events, average arrival rate, average finish rate, waiting time, service time, rework count, cases per resource, events per case, number of cases, and resources per case.
- Example with GROUPER_FREQ=”D”:
day 2024-01-01 has 2 cases and 5 events day 2024-01-02 has 1 case and 2 events
The result has two rows, one for each day, with columns such as number_of_cases=[2, 1] and num_events=[5, 2].
Implements the approach described in the paper: Pourbafrani, Mahsa, Sebastiaan J. van Zelst, and Wil MP van der Aalst. “Supporting automatic system dynamics model generation for simulation in the context of process mining.” International Conference on Business Information Systems. Springer, Cham, 2020.
- Parameters:
log – Event log / Event stream / Pandas dataframe
parameters – Parameters of the algorithm, including:
Parameters.GROUPER_FREQ => the time interval to be used for the grouping (default: “W”)
Parameters.ARRIVAL_RATE => column of the dataframe which is going to host the arrival rate
Parameters.FINISH_RATE => column of the dataframe which is going to host the finishing rate
Parameters.SERVICE_TIME => column of the dataframe which is going to host the service time
Parameters.WAITING_TIME => column of the dataframe which is going to host the waiting time
Parameters.SOJOURN_TIME => column of the dataframe which is going to host the sojourn time
Parameters.CASE_ID_COLUMN => case ID column in the dataframe (default: case:concept:name)
Parameters.ACTIVITY_COLUMN => activity column in the dataframe (default: concept:name)
Parameters.TIMESTAMP_COLUMN => timestamp column in the dataframe (default: time:timestamp)
Parameters.RESOURCE_COLUMN => resource column in the dataframe (default: org:resource)
Parameters.START_TIMESTAMP_COLUMN => start timestamp column in the dataframe (if not provided, the timestamp column is used)
- Returns:
Dataframe with temporal features, aggregated per time window
- Return type:
features_df