pm4py.statistics.traces.generic.polars.case_statistics 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.statistics.traces.generic.polars.case_statistics.Parameters(*values)[source]#
Bases:
Enum- ATTRIBUTE_KEY = 'pm4py:param:attribute_key'#
- ACTIVITY_KEY = 'pm4py:param:activity_key'#
- TIMESTAMP_KEY = 'pm4py:param:timestamp_key'#
- CASE_ID_KEY = 'pm4py:param:case_id_key'#
- START_TIMESTAMP_KEY = 'pm4py:param:start_timestamp_key'#
- MAX_VARIANTS_TO_RETURN = 'max_variants_to_return'#
- VARIANTS_DF = 'variants_df'#
- ENABLE_SORT = 'enable_sort'#
- SORT_BY_COLUMN = 'sort_by_column'#
- SORT_ASCENDING = 'sort_ascending'#
- MAX_RET_CASES = 'max_ret_cases'#
- BUSINESS_HOURS = 'business_hours'#
- BUSINESS_HOUR_SLOTS = 'business_hour_slots'#
- WORKCALENDAR = 'workcalendar'#
- pm4py.statistics.traces.generic.polars.case_statistics.get_variant_statistics(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) List[Dict[str, Any]][source]#
Get variants from a Polars LazyFrame
- Parameters:
lf – LazyFrame
parameters –
- Parameters of the algorithm, including:
Parameters.CASE_ID_KEY -> Column that contains the Case ID Parameters.ACTIVITY_KEY -> Column that contains the activity Parameters.MAX_VARIANTS_TO_RETURN -> Maximum number of variants to return
- Returns:
List of variants inside the LazyFrame
- Return type:
variants_list
- pm4py.statistics.traces.generic.polars.case_statistics.get_variants_df_and_list(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) Tuple[polars.DataFrame, List[List[Any]]][source]#
(Technical method) Provides variants_df and variants_list out of the box
- Parameters:
lf – LazyFrame
parameters –
- Parameters of the algorithm, including:
Parameters.CASE_ID_KEY -> Column that contains the Case ID Parameters.ACTIVITY_KEY -> Column that contains the activity
- Returns:
variants_df – Variants dataframe
variants_list – List of variants sorted by their count
- pm4py.statistics.traces.generic.polars.case_statistics.get_cases_description(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) List[Dict[str, Any]][source]#
Get a description of traces in the dataframe
- Parameters:
lf – LazyFrame
parameters –
- Parameters of the algorithm, including:
Parameters.CASE_ID_KEY -> Column that contains the Case ID Parameters.TIMESTAMP_KEY -> Column that contains the timestamp
- Returns:
Dictionary of cases with their start time, end time, and case duration
- Return type:
ret
- pm4py.statistics.traces.generic.polars.case_statistics.get_variants_df(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) polars.DataFrame[source]#
Gets the variants dataframe
- Parameters:
lf – LazyFrame
parameters –
- Parameters of the algorithm, including:
Parameters.CASE_ID_KEY -> Column that contains the Case ID Parameters.ACTIVITY_KEY -> Column that contains the activity
- Returns:
Variants dataframe
- Return type:
variants_df
- pm4py.statistics.traces.generic.polars.case_statistics.get_all_case_durations(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) List[float][source]#
Gets all case durations
- Parameters:
lf – LazyFrame
parameters – Parameters of the algorithm
- Returns:
List of case durations
- Return type:
case_durations
- pm4py.statistics.traces.generic.polars.case_statistics.get_median_case_duration(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) float[source]#
Gets the median case duration
- Parameters:
lf – LazyFrame
parameters – Parameters of the algorithm
- Returns:
Median case duration
- Return type:
median_case_duration
- pm4py.statistics.traces.generic.polars.case_statistics.get_first_quartile_case_duration(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) float[source]#
Gets the first quartile case duration
- Parameters:
lf – LazyFrame
parameters – Parameters of the algorithm
- Returns:
First quartile case duration
- Return type:
first_quartile_case_duration
- pm4py.statistics.traces.generic.polars.case_statistics.get_kde_caseduration(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) Tuple[List[float], List[float]][source]#
Gets the KDE estimation for case durations
- Parameters:
lf – LazyFrame
parameters – Parameters of the algorithm
- Returns:
X and Y values for KDE
- Return type:
x, y
- pm4py.statistics.traces.generic.polars.case_statistics.get_kde_caseduration_json(lf: polars.LazyFrame, parameters: Dict[str | Parameters, Any] | None = None) Dict[str, Any][source]#
Gets the KDE estimation for case durations (JSON format)
- Parameters:
lf – LazyFrame
parameters – Parameters of the algorithm
- Returns:
JSON representation of KDE
- Return type:
json_data