pm4py.objects.log.util.df_features_utils 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
- pm4py.objects.log.util.df_features_utils.automatic_feature_selection_df(df, parameters=None)[source]#
Performs an automatic feature selection on dataframes, keeping the features useful for ML purposes
- Parameters:
df – Dataframe
parameters – Parameters of the algorithm
- Returns:
Dataframe with only the features that have been selected
- Return type:
featured_df
- pm4py.objects.log.util.df_features_utils.select_number_column(df: DataFrame, fea_df: DataFrame, col: str, case_id_key='case:concept:name', enable_numeric_attribute_statistics=False, numeric_attribute_aggregations: Collection[str] | None = None) DataFrame[source]#
Extract a column for the features dataframe for the given numeric attribute
- Parameters:
df – Dataframe
fea_df – Feature dataframe
col – Numeric column
case_id_key – Case ID key
enable_numeric_attribute_statistics – If True, extract numeric aggregation columns.
numeric_attribute_aggregations – Aggregations to compute for numeric attributes. Supported values are last, first, min, max, mean, median, stdev, and sum. Applied only to attributes whose names do not start with @@.
- Returns:
Feature dataframe (desidered output)
- Return type:
fea_df
- pm4py.objects.log.util.df_features_utils.select_string_column(df: DataFrame, fea_df: DataFrame, col: str, case_id_key='case:concept:name', count_occurrences=False) DataFrame[source]#
Extract N columns (for N different attribute values; hotencoding) for the features dataframe for the given string attribute
- Parameters:
df – Dataframe
fea_df – Feature dataframe
col – String column
case_id_key – Case ID key
count_occurrences – If True, count the number of occurrences of the attribute value in each case. If False (default), use binary encoding (1 if present, 0 if not present)
- Returns:
Feature dataframe (desidered output)
- Return type:
fea_df
- pm4py.objects.log.util.df_features_utils.get_features_df(df: DataFrame, list_columns: List[str], parameters: Dict[Any, Any] | None = None) DataFrame[source]#
Given a dataframe and a list of columns, performs an automatic feature extraction
- Parameters:
df – Dataframe
list_column – List of column to consider in the feature extraction
parameters – Parameters of the algorithm, including: - Parameters.CASE_ID_KEY: the case ID - Parameters.COUNT_OCCURRENCES: if True, count occurrences of string attributes instead of binary encoding - Parameters.ENABLE_NUMERIC_ATTRIBUTE_STATISTICS: if True, extract aggregation statistics for numeric attributes - Parameters.NUMERIC_ATTRIBUTE_AGGREGATIONS: collection of aggregations to compute for numeric attributes
whose names do not start with @@
- Returns:
Feature dataframe (desidered output)
- Return type:
fea_df
- pm4py.objects.log.util.df_features_utils.automatic_feature_extraction_df(df: DataFrame, parameters: Dict[Any, Any] | None = None) DataFrame[source]#
Performs an automatic feature extraction given a dataframe
- Parameters:
df – Dataframe
parameters – Parameters of the algorithm, including: - Parameters.CASE_ID_KEY: the case ID - Parameters.MIN_DIFFERENT_OCC_STR_ATTR - Parameters.MAX_DIFFERENT_OCC_STR_ATTR
- Returns:
Dataframe with the features
- Return type:
fea_df