Skip to content

Commit b50c630

Browse files
fix: correct functions based on failing tests
1 parent 621337c commit b50c630

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ontograph/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,14 @@ def _create_reverse_mapping(
6363
Returns:
6464
A dictionary where keys are IDs from source columns and values are from the target_column.
6565
"""
66-
if dataframe.empty or target_column not in dataframe.columns:
66+
if dataframe.empty:
6767
return set(), {}
6868

69+
if target_column not in dataframe.columns:
70+
raise KeyError(
71+
f"Target column '{target_column}' not found in DataFrame."
72+
)
73+
6974
# Ensure we only work with rows that have a target ID
7075
df_filtered = dataframe.dropna(subset=[target_column])
7176

0 commit comments

Comments
 (0)