我正在尝试将XES事件日志文件转换为CSV,但无法从pm4py导入工厂。当我使用代码时:
from pm4py.objects.log.importer.xes import factory
log = xes_import_factory.apply("<path_to_xes_file>")
我得到错误:
ImportError:无法从"pm4py.objects.log.importer.xes"(C:\Users\Nutzer\anaconda3\lib\site packages\pm4py\objects\log\importer\xes_init_.py(导入名称"工厂">
我已经在我的终端上安装了pm4py,我不确定如何更正错误。
简单的、非参数化的方法是:
log = pm4py.read_xes('log.xes.gz')
pd = pm4py.convert_to_dataframe(log)
参数化方式:
from pm4py.objects.conversion.log import converter as xes_converter
from pm4py.objects.log.importer.xes import importer as xes_importer
log = xes_importer.apply('log.xes')
pd = xes_converter.apply(log, variant=xes_converter.Variants.TO_DATA_FRAME)
在大多数情况下,"简单"调用就足够了。