mtt_haum/code/06_infos-items.py

38 lines
1.0 KiB
Python
Raw Normal View History

# 06_infos-items.py
#
# content: (1) Load data and create event log
# (2) Infos for items
#
2024-03-22 12:07:45 +01:00
# input: results/eventlogs_pre-corona_cleaned.csv
# output: results/pn_infos_items.csv
#
2024-03-22 12:07:45 +01:00
# last mod: 2024-03-22
import pm4py
import pandas as pd
import numpy as np
from python_helpers import eval_pm, pn_infos
#--------------- (1) Load data and create event logs ---------------
2024-03-22 12:07:45 +01:00
dat = pd.read_csv("results/eventlogs_pre-corona_cleaned", sep = ";")
log_path = pm4py.format_dataframe(dat, case_id = "path", activity_key = "event",
timestamp_key = "date.start")
#--------------- (2) Infos for items ---------------
eval = pd.DataFrame(columns = ["fitness", "precision", "generalizability",
"simplicity", "sound", "narcs", "ntrans",
"nplaces", "nvariants", "mostfreq"])
for item in log_path.item.unique().tolist():
eval = pd.concat([eval, pn_infos(log_path, "item", item)])
eval = eval.sort_index()
# Export
2024-03-22 12:07:45 +01:00
eval.to_csv("results/pn_infos_items.csv", sep = ";")