Skip to content

Commit

Permalink
Fix pd.DataFrame indexing in convert_tables_to_dicts()
Browse files Browse the repository at this point in the history
Resolves: Project-MONAI#8201

Signed-off-by: Bartosz Grabowski <[email protected]>
  • Loading branch information
bartosz-grabowski committed Feb 18, 2025
1 parent 44add8d commit e2c7038
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monai/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,7 @@ def convert_tables_to_dicts(
rows.append(i)

# convert to a list of dictionaries corresponding to every row
data_ = df.loc[rows] if col_names is None else df.loc[rows, col_names]
data_ = df.iloc[rows] if col_names is None else df.iloc[rows][col_names]
if isinstance(col_types, dict):
# fill default values for NaN
defaults = {k: v["default"] for k, v in col_types.items() if v is not None and v.get("default") is not None}
Expand Down

0 comments on commit e2c7038

Please sign in to comment.