pm4py / pm4py-core

Public repository for the PM4Py (Process Mining for Python) project.
https://pm4py.fit.fraunhofer.de
GNU General Public License v3.0
722 stars 286 forks source link

Import CSV #24

Closed hadisotudeh closed 5 years ago

hadisotudeh commented 5 years ago

Hi,

I get the following error when I import a CSV file. KeyError: 'concept:name'

My code:

from pm4py.objects.log.importer.csv import factory as csv_importer

event_log = csv_importer.import_log('grouped/'+file_name)

from pm4py.objects.log import transform

trace_log = transform.transform_event_log_to_trace_log(event_log,case_glue="caseID")

net, initial_marking, final_marking = inductive_miner.apply(trace_log)

gviz = vis_factory.apply(net, initial_marking, final_marking)
vis_factory.view(gviz)

It seems I should change the activity column to 'name'. Is there a way to not do so?

Javert899 commented 5 years ago

Hi,

When you apply the Inductive Miner, you should provide a parameter specifying in which attribute the activity is written.

You could provide that (see http://pm4py.pads.rwth-aachen.de/documentation/process-discovery/classifiers/ ) using the following code (replace concept:name with the attribute containing the activity):

from pm4py.util import constants parameters = {constants.PARAMETER_CONSTANT_ACTIVITY_KEY: "concept:name"} net, initial_marking, final_marking = inductive_miner.apply(log, parameters=parameters)

hadisotudeh commented 5 years ago

Great. It worked.