converters.csv_to_xes: missing case IDs and activities become "nan" #10

Open
opened 2026-10-06 13:46:01 +00:00 by ffrauenberger · 0 comments
Owner

Severity: medium (rows with missing values end up in an artificial case or activity nan)

Where

  • app/converters/csv_to_xes_converter.py:46-58

Problem

df[self.xes_case_col] = df[self.xes_case_col].astype(str)
df[self.xes_activity_col] = df[self.xes_activity_col].astype(str)
...
df = df.dropna(subset=[case, activity, timestamp])

astype(str) converts NaN to the literal string "nan" before dropna runs. Rows with a missing case ID or activity are therefore never dropped; only rows with a missing timestamp are removed.

Steps to reproduce

  1. Open the application
  2. Use the CSV to XES converter on a CSV in which some rows have an empty case ID and others an empty activity
  3. Inspect the converted XES file and the "Removed N rows with missing values" message

Expected behavior

Rows with a missing case ID, activity or timestamp are removed, and the reported count includes all of them.

Actual behavior

  • All events without a case ID end up in one artificial trace with concept:name="nan".
  • Events without an activity get an activity called nan.
  • The reported number of removed rows is too low, and the summary includes the artificial case.

Fix

Run dropna on the selected columns before the string conversion, and also treat empty or whitespace-only strings as missing.


from issues/BUG-010-csv-to-xes-missing-values-become-nan-strings.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** medium (rows with missing values end up in an artificial case or activity `nan`) ## Where - `app/converters/csv_to_xes_converter.py:46-58` ## Problem ```python df[self.xes_case_col] = df[self.xes_case_col].astype(str) df[self.xes_activity_col] = df[self.xes_activity_col].astype(str) ... df = df.dropna(subset=[case, activity, timestamp]) ``` `astype(str)` converts `NaN` to the literal string `"nan"` **before** `dropna` runs. Rows with a missing case ID or activity are therefore never dropped; only rows with a missing timestamp are removed. ### Steps to reproduce 1. Open the application 2. Use the CSV to XES converter on a CSV in which some rows have an empty case ID and others an empty activity 3. Inspect the converted XES file and the "Removed N rows with missing values" message ### Expected behavior Rows with a missing case ID, activity or timestamp are removed, and the reported count includes all of them. ### Actual behavior - All events without a case ID end up in one artificial trace with `concept:name="nan"`. - Events without an activity get an activity called `nan`. - The reported number of removed rows is too low, and the summary includes the artificial case. ## Fix Run `dropna` on the selected columns **before** the string conversion, and also treat empty or whitespace-only strings as missing. --- from `issues/BUG-010-csv-to-xes-missing-values-become-nan-strings.md` (code analysis of commit 6bcc646, 2026-10-03)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#10
No description provided.