pm4py.utils.parse_event_log_string#

pm4py.utils.parse_event_log_string(traces: Collection[str], sep: str = ',', activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name', return_legacy_log_object: bool = False) EventLog | DataFrame[source]#

Parses a collection of traces expressed as strings (e.g., [“A,B,C,D”, “A,C,B,D”, “A,D”]) into a log object.

Parameters:
  • traces – Collection of traces expressed as strings.

  • sep (str) – Separator used to split the activities in a string trace.

  • activity_key (str) – The attribute to be used as activity.

  • timestamp_key (str) – The attribute to be used as timestamp.

  • case_id_key (str) – The attribute to be used as case identifier.

  • return_legacy_log_object (bool) – If True, returns a legacy log object (EventLog). If False, returns a Pandas DataFrame. Default is False.

Returns:

A log object, either as a legacy EventLog or a Pandas DataFrame.

Return type:

Union[EventLog, pd.DataFrame]

import pm4py

dataframe = pm4py.parse_event_log_string(["A,B,C,D", "A,C,B,D", "A,D"])