pm4py.algo.filtering.pandas.prefixes package#

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.

Submodules#

pm4py.algo.filtering.pandas.prefixes.prefix_filter module#

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.

class pm4py.algo.filtering.pandas.prefixes.prefix_filter.Parameters(value)[source]#

Bases: Enum

An enumeration.

CASE_ID_KEY = 'pm4py:param:case_id_key'#
ACTIVITY_KEY = 'pm4py:param:activity_key'#
INDEX_KEY = 'index_key'#
INDEX_IN_TRACE_KEY = 'index_in_trace_key'#
USE_EXTREMES_TIMESTAMP = 'use_extremes_timestamp'#
TEMP_COLUMN = 'temp_column'#
FIRST_OR_LAST = 'first_or_last'#
STRICT = 'strict'#
pm4py.algo.filtering.pandas.prefixes.prefix_filter.apply(df: DataFrame, activity: str, parameters: Optional[Dict[Any, Any]] = None)[source]#

Filter all the prefixes to a given activity (first or last occurrence of the activity in the case).

Parameters#

df

Dataframe

parameters

Parameters of the algorithm: - Parameters.CASE_ID_KEY => the case identifier column. - Parameters.ACTIVITY_KEY => the activity column. - Parameters.INDEX_IN_TRACE_KEY => attribute that should act as container of the index of the event inside

the case.

  • Parameters.TEMP_COLUMN => temporary column which is used for internal purposes.

  • Parameters.FIRST_OR_LAST => filter on the first or last occurrence of an activity in the dataframe.

  • Parameters.STRICT => applies the filter in a strict (<) or lean (<=) way (boolean).

Returns#

df

Dataframe filtered keeping the prefixes to a given activity (first or last occurrence of the activity in the case).