Skip to content

Commit 8e38af7

Browse files
authored
Merge pull request #173 from UCL-CORU/fix/col-name-mistmatch-error
fix col name mismatch error
2 parents 5aacf84 + b666380 commit 8e38af7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/patientflow/prepare.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,9 @@ def prepare_patient_snapshots(
595595
df_single = select_one_snapshot_per_visit(df_tod, visit_col)
596596
# Create label array with the same index
597597
y = df_single.pop(label_col).astype(int)
598-
# Drop specified columns and ensure we do not reset the index
599-
df_single.drop(columns=exclude_columns, inplace=True)
598+
# Drop specified columns and ensure we do not reset the index.
599+
# Ignore missing column names so behavior matches the multi-snapshot path.
600+
df_single.drop(columns=exclude_columns, inplace=True, errors="ignore")
600601
return df_single, y
601602
else:
602603
# Directly modify df_tod without resetting the index

0 commit comments

Comments
 (0)