pm4py.util package¶
Subpackages¶
- pm4py.util.dt_parsing package
- pm4py.util.lp package
- Subpackages
- pm4py.util.lp.util package
- pm4py.util.lp.variants package
- Submodules
- pm4py.util.lp.variants.cvxopt_solver module
- pm4py.util.lp.variants.cvxopt_solver_custom_align module
- pm4py.util.lp.variants.cvxopt_solver_custom_align_arm module
- pm4py.util.lp.variants.cvxopt_solver_custom_align_ilp module
- pm4py.util.lp.variants.ortools_solver module
- pm4py.util.lp.variants.pulp_solver module
- Module contents
- Submodules
- pm4py.util.lp.parameters module
- pm4py.util.lp.solver module
- Module contents
- Subpackages
Submodules¶
pm4py.util.business_hours 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.util.business_hours.BusinessHours(datetime1, datetime2, **kwargs)[source]¶ Bases:
object
-
pm4py.util.business_hours.soj_time_business_hours_diff(st: datetime.datetime, et: datetime.datetime, worktiming: List[int], weekends: List[int], workcalendar=None) → float[source]¶ Calculates the difference between the provided timestamps based on the business hours
Parameters: st – Start timestamp
et – Complete timestamp
worktiming –
- work schedule of the company (provided as a list where the first number is the start
- of the work time, and the second number is the end of the work time), if business hours are enabled
Default: [7, 17] (work shift from 07:00 to 17:00)
weekends –
- indexes of the days of the week that are weekend
Default: [6, 7] (weekends are Saturday and Sunday)
Returns: Difference in business hours
Return type: diff
pm4py.util.colors 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/>.
-
pm4py.util.colors.get_corr_hex(num)[source]¶ Gets correspondence between a number and an hexadecimal string
Parameters: num – Number Returns: Hexadecimal string Return type: hex_string
pm4py.util.constants 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/>.
pm4py.util.exec_utils 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/>.
pm4py.util.pandas_utils 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/>.
-
pm4py.util.pandas_utils.check_dataframe_columns(df)[source]¶ Checks if the dataframe contains all the required columns. If not, raise an exception
Parameters: df – Pandas dataframe Deprecated since version 2.2.8: This will be removed in 3.0.0. use check_pandas_dataframe_columns instead
-
pm4py.util.pandas_utils.check_is_dataframe(log)[source]¶ Checks if a log object is a dataframe
Parameters: log – Log object Returns: Is dataframe? Return type: boolean Deprecated since version 2.2.8: This will be removed in 3.0.0. use check_is_pandas_dataframe instead
-
pm4py.util.pandas_utils.check_is_pandas_dataframe(log)[source]¶ Checks if a log object is a dataframe
Parameters: log – Log object Returns: Is dataframe? Return type: boolean
-
pm4py.util.pandas_utils.check_pandas_dataframe_columns(df)[source]¶ Checks if the dataframe contains all the required columns. If not, raise an exception
Parameters: df – Pandas dataframe
-
pm4py.util.pandas_utils.insert_case_index(df, column_name='@@case_index', case_id='case:concept:name', copy_dataframe=True)[source]¶ Inserts the case number in the dataframe
Parameters: - df – Dataframe
- column_name – Name of the column that should host the case index
- case_id – Case identifier
- copy_dataframe – Establishes if the original dataframe should be copied before inserting the column
Returns: Dataframe with case index
Return type: df
-
pm4py.util.pandas_utils.insert_ev_in_tr_index(df: pandas.core.frame.DataFrame, case_id: str = 'case:concept:name', column_name: str = '@@index_in_trace') → pandas.core.frame.DataFrame[source]¶ Inserts a column that specify the index of the event inside the case
Parameters: - df – Dataframe
- case_id – Column that hosts the case identifier
- column_name – Name of the column that should host the index
Returns: Dataframe with index
Return type: df
-
pm4py.util.pandas_utils.insert_feature_activity_position_in_trace(df: pandas.core.frame.DataFrame, case_id: str = 'case:concept:name', activity_key: str = 'concept:name', prefix='@@position_')[source]¶ Inserts additional columns @@position_ACT1, @@position_ACT2 … which are populated for every event having activity ACT1, ACT2 respectively, with the index of the event inside its case.
Parameters: - df – Pandas dataframe
- case_id – Case idntifier
- activity_key – Activity
- prefix – Prefix of the “activity position in trace” feature (default: @@position_)
Returns: Pandas dataframe
Return type: df
-
pm4py.util.pandas_utils.insert_index(df, column_name='@@index', copy_dataframe=True)[source]¶ Inserts the dataframe index in the specified column
Parameters: - df – Dataframe
- column_name – Name of the column that should host the index
- copy_dataframe – Establishes if the original dataframe should be copied before inserting the column
Returns: Dataframe with index
Return type: df
pm4py.util.parameters 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/>.
pm4py.util.points_subset 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/>.
pm4py.util.regex 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/>.
Bases:
object
-
pm4py.util.regex.check_reg_matching(reg, stringa)[source]¶ Check if a regular expression matches a given string
Parameters: - reg – Regular expression
- stringa – String
Returns: Matches or not?
Return type: boolean
Deprecated since version 2.2.11: This will be removed in 3.0.0. removed
-
pm4py.util.regex.get_new_char(label, shared_obj)[source]¶ Get a new single character describing the activity, for the regex
Parameters: - label – Label of the transition
- shared_obj – Shared object
-
pm4py.util.regex.regex_replace_mapping(reg_stri, mapping, special_char='@@', parameters=None)[source]¶ Replace strings in a regex given the mapping
Parameters: - reg_stri – Regex string
- mapping – Mapping
- special_char – Specification of the special character
- parameters – Parameters of the algorithm
Returns: Compiled Regex where the elements where replaced according to the mapping
Return type: reg
Deprecated since version 2.2.11: This will be removed in 3.0.0. removed
pm4py.util.string_distance 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/>.
-
pm4py.util.string_distance.argmax_levenshtein(stru: str, list_stri: List[str]) → Optional[str][source]¶ Given a string (stru), finds a string in a list of strings (list_stri) that maximizes the Levenshtein distance.
Parameters: - stru – String (that is compared)
- list_stri – List of comparison strings
Returns: String (belonging to list_stri) that maximizes the Levenshtein distance with the ‘stru’ argument
Return type: argmax_dist
-
pm4py.util.string_distance.argmin_levenshtein(stru: str, list_stri: List[str]) → Optional[str][source]¶ Given a string (stru), finds a string in a list of strings (list_stri) that minimizes the Levenshtein distance.
Parameters: - stru – String (that is compared)
- list_stri – List of comparison strings
Returns: String (belonging to list_stri) that minimizes the Levenshtein distance with the ‘stru’ argument
Return type: argmin_dist
-
pm4py.util.string_distance.levenshtein(stru1, stru2)¶
pm4py.util.typing 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/>.
pm4py.util.variants_util 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.util.variants_util.Parameters[source]¶ Bases:
enum.EnumAn enumeration.
-
ACTIVITY_KEY= 'pm4py:param:activity_key'¶
-
PARAMETER_VARIANT_DELIMITER= 'variant_delimiter'¶
-
pm4py.util.vers_checker 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/>.
pm4py.util.vis_utils 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/>.
-
pm4py.util.vis_utils.check_visualization_inside_jupyter()[source]¶ Checks if the visualization of the model is performed inside a Jupyter notebook
-
pm4py.util.vis_utils.get_arc_penwidth(arc_measure, min_arc_measure, max_arc_measure)[source]¶ Calculate arc width given the current arc measure value, the minimum arc measure value and the maximum arc measure value
Parameters: - arc_measure – Current arc measure value
- min_arc_measure – Minimum measure value among all arcs
- max_arc_measure – Maximum measure value among all arcs
Returns: Current arc width in the graph
Return type: penwidth
-
pm4py.util.vis_utils.get_base64_from_file(temp_file)[source]¶ Get base 64 from string content of the file
Parameters: temp_file – Temporary file path Returns: Base64 string Return type: base64
-
pm4py.util.vis_utils.get_base64_from_gviz(gviz)[source]¶ Get base 64 from string content of the file
Parameters: gviz – Graphviz diagram Returns: Base64 string Return type: base64
-
pm4py.util.vis_utils.get_corr_hex(num)[source]¶ Gets correspondence between a number and an hexadecimal string
Parameters: num – Number Returns: Hexadecimal string Return type: hex_string
-
pm4py.util.vis_utils.get_trans_freq_color(trans_count, min_trans_count, max_trans_count)[source]¶ Gets transition frequency color
Parameters: - trans_count – Current transition count
- min_trans_count – Minimum transition count
- max_trans_count – Maximum transition count
Returns: Frequency color for visible transition
Return type: color
-
pm4py.util.vis_utils.human_readable_stat(timedelta_seconds, stat_locale: dict = {})[source]¶ Transform a timedelta expressed in seconds into a human readable string
Parameters: - timedelta_seconds – Timedelta expressed in seconds
- stat_locale – Dict mapping stat strings
Returns: Human readable string
Return type: string
pm4py.util.xes_constants 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/>.
Module contents¶
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/>.