pm4py.algo.filtering.polars.cases.case_filter 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.filtering.polars.cases.case_filter.Parameters(*values)[source]#

Bases: Enum

TIMESTAMP_KEY = 'pm4py:param:timestamp_key'#
CASE_ID_KEY = 'pm4py:param:case_id_key'#
BUSINESS_HOURS = 'business_hours'#
BUSINESS_HOUR_SLOTS = 'business_hour_slots'#
WORKCALENDAR = 'workcalendar'#
pm4py.algo.filtering.polars.cases.case_filter.filter_on_ncases(df: polars.LazyFrame, case_id_glue: str = 'case:concept:name', max_no_cases: int = 1000) → polars.LazyFrame[source]#

Filter a LazyFrame keeping only the specified maximum number of traces

Parameters:
  • df – LazyFrame

  • case_id_glue – Case ID column

  • max_no_cases – Maximum number of traces to keep

Returns:

Filtered LazyFrame

Return type:

df

pm4py.algo.filtering.polars.cases.case_filter.filter_on_case_size(df: polars.LazyFrame, case_id_glue: str = 'case:concept:name', min_case_size: int = 2, max_case_size: int | None = None) → polars.LazyFrame[source]#

Filter a LazyFrame keeping only traces with at least the specified number of events

Parameters:
  • df – LazyFrame

  • case_id_glue – Case ID column

  • min_case_size – Minimum size of a case

  • max_case_size – Maximum case size

Returns:

Filtered LazyFrame

Return type:

df

pm4py.algo.filtering.polars.cases.case_filter.filter_on_case_performance(df: polars.LazyFrame, case_id_glue: str = 'case:concept:name', timestamp_key: str = 'time:timestamp', min_case_performance: float = 0, max_case_performance: float = 10000000000, business_hours: bool = False, business_hours_slots=None) → polars.LazyFrame[source]#

Filter a LazyFrame on case performance

Parameters:
  • df – LazyFrame

  • case_id_glue – Case ID column

  • timestamp_key – Timestamp column to use

  • min_case_performance – Minimum case performance (in seconds)

  • max_case_performance – Maximum case performance (in seconds)

  • business_hours – Whether to calculate duration using business hours

  • business_hours_slots – Business hour slots (if business_hours is True)

Returns:

Filtered LazyFrame

Return type:

df

pm4py.algo.filtering.polars.cases.case_filter.filter_case_performance(df: polars.LazyFrame, min_case_performance: float = 0, max_case_performance: float = 10000000000, parameters: Dict[str | Parameters, Any] | None = None) → polars.LazyFrame[source]#

Filter a LazyFrame on case performance using parameters

Parameters:
  • df – LazyFrame

  • min_case_performance – Minimum case performance (in seconds)

  • max_case_performance – Maximum case performance (in seconds)

  • parameters – Parameters dictionary

Returns:

Filtered LazyFrame

Return type:

df

pm4py.algo.filtering.polars.cases.case_filter.apply(df, parameters=None)[source]#
pm4py.algo.filtering.polars.cases.case_filter.apply_auto_filter(df, parameters=None)[source]#