pm4py.filtering.filter_suffixes#
- pm4py.filtering.filter_suffixes(log: EventLog | DataFrame, activity: str, strict=True, first_or_last='first', activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') EventLog | DataFrame [source]#
Filters the log, keeping the suffixes from a given activity. E.g., for a log with traces:
A,B,C,D A,B,Z,A,B,C,D A,B,C,D,C,E,C,F
The suffixes from “C” are respectively:
D D D,C,E,C,F
- Parameters:
log – event log / Pandas dataframe
activity (
str
) – target activity of the filterstrict (
bool
) – applies the filter strictly (cuts the occurrences of the selected activity).first_or_last (
str
) – decides if the first or last occurrence of an activity should be selected as baseline for the filter.activity_key (
str
) – attribute to be used for the activitytimestamp_key (
str
) – attribute to be used for the timestampcase_id_key (
str
) – attribute to be used as case identifier
- Return type:
Union[EventLog, pd.DataFrame]
import pm4py filtered_dataframe = pm4py.filter_prefixes(dataframe, 'Act. C', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name')