def get_event_attribute_values(log: Union[EventLog, pd.DataFrame], attribute: str, count_once_per_case=False) -> Dict[str, int]: """ Returns the values for a specified attribute Parameters --------------- log Log object attribute Attribute count_once_per_case If True, consider only an occurrence of the given attribute value inside a case (if there are multiple events sharing the same attribute value, count only 1 occurrence) Returns --------------- attribute_values Dictionary of values along with their count """ if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") parameters = get_properties(log) parameters["keep_once_per_case"] = count_once_per_case if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log) from pm4py.statistics.attributes.pandas import get return get.get_attribute_values(log, attribute, parameters=parameters) else: from pm4py.statistics.attributes.log import get return get.get_attribute_values(log, attribute, parameters=parameters)
def get_trace_attribute_values(log: Union[EventLog, pd.DataFrame], attribute: str) -> Dict[str, int]: """ Returns the values for a specified trace attribute Parameters --------------- log Log object attribute Attribute Returns --------------- attribute_values Dictionary of values along with their count """ if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log) from pm4py.statistics.attributes.pandas import get return get.get_attribute_values(log, attribute) else: from pm4py.statistics.attributes.log import get return get.get_trace_attribute_values(log, attribute)
def get_attribute_values(log, attribute): """ Returns the values for a specified attribute Parameters --------------- log Log object attribute Attribute Returns --------------- attribute_values Dictionary of values along with their count """ if check_is_dataframe(log): check_dataframe_columns(log) from pm4py.statistics.attributes.pandas import get return get.get_attribute_values(log, attribute) else: from pm4py.statistics.attributes.log import get return get.get_attribute_values(log, attribute)
def get_trace_attribute_values(log: Union[EventLog, pd.DataFrame], attribute: str) -> Dict[str, int]: """ Returns the values for a specified trace attribute Parameters --------------- log Log object attribute Attribute Returns --------------- attribute_values Dictionary of values along with their count """ if check_is_dataframe(log): check_dataframe_columns(log) from pm4py.statistics.attributes.pandas import get return get.get_attribute_values(log, attribute) else: from pm4py.statistics.attributes.log import get return get.get_trace_attribute_values(log, attribute)