Skip to content

Conversation

@bartosz-grabowski
Copy link
Contributor

Fixes #8201 .

Description

convert_tables_to_dicts was using .loc to index DataFrames which was changed to .iloc. It was causing unexpected behavior in CSVDataset as demonstrated in #8201 because .loc expects labels, but was instead provided positions of the rows.
Unittest was added which fails before the change and passes afterwards.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Resolves: Project-MONAI#8201

Signed-off-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
Signed-off-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
@bartosz-grabowski bartosz-grabowski marked this pull request as ready for review February 18, 2025 23:41
@bartosz-grabowski bartosz-grabowski marked this pull request as draft February 18, 2025 23:58
Also updated the unittest to pass after the fix and not before.

Signed-off-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
@bartosz-grabowski bartosz-grabowski marked this pull request as ready for review February 19, 2025 00:35
@bartosz-grabowski
Copy link
Contributor Author

/black

Signed-off-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
@bartosz-grabowski
Copy link
Contributor Author

@KumoLiu @ericspod could you take a look at this?

@ericspod ericspod requested review from KumoLiu and ericspod March 3, 2025 17:31
Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go, we're waiting on a large PR to be merged, then we'll update this one and move forward.

@KumoLiu
Copy link
Contributor

KumoLiu commented Mar 4, 2025

/build

1 similar comment
@KumoLiu
Copy link
Contributor

KumoLiu commented Mar 5, 2025

/build

…ow_indices != None

By changing .loc to .iloc, the previous fix didn't work for row_indices != None and df subsets,
because it assumed positional index instead of label index.

Signed-off-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
…et()

Signed-off-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
@KumoLiu
Copy link
Contributor

KumoLiu commented Mar 20, 2025

/build

@KumoLiu KumoLiu enabled auto-merge (squash) March 20, 2025 03:12
@KumoLiu KumoLiu merged commit 41d6c9c into Project-MONAI:dev Mar 20, 2025
26 checks passed
@bartosz-grabowski bartosz-grabowski deleted the 8201-fix-csvdataset-dfs-indexing branch March 20, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSVDataset behaves unexpectedly if src is a dataframe unexpected index

3 participants