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

In Docs > getting started: import_csv() #491

Closed vddo closed 4 months ago

vddo commented 4 months ago

Hi, I have a question regarding the import_csv function in Getting started > Importing your first event log > Loading csv files.

def import_csv(file_path):
    event_log = pandas.read_csv(file_path, sep=';')
    num_events = len(event_log)
    num_cases = len(event_log.case_id.unique())
    print("Number of events: {}\nNumber of cases: {}".format(num_events, num_cases))

In line 4 (num_cases) how can case_id be an attribute of pandas.DataFrame? Maybe it should look like this:

   num_cases = len(event_log['case_id'].unique())
fit-alessandro-berti commented 4 months ago

Dear @vddo

If the name of the column does not contain strange characters, like in the mentioned situation, then dataframe.case_id is equivalent to dataframe["case_id"]