Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DataFrame.reindex when column reindexing to MultiIndex/RangeIndex #14605

Merged
merged 4 commits into from
Dec 13, 2023

Conversation

mroeschke
Copy link
Contributor

Description

  1. reindex(columns=cudf.MultiIndex) will raise since set(cudf.MultiIndex) is being called
  2. reindex(columns=range/RangeIndex) would not necessarily retain a RangeIndex result

Discovered during refactoring DataFrame.__init__ and further convinces me that the column should be passed to ColumnAccessor eventually

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke added bug Something isn't working non-breaking Non-breaking change python labels Dec 9, 2023
@mroeschke mroeschke requested a review from a team as a code owner December 9, 2023 00:20
@github-actions github-actions bot added the Python Affects Python cuDF API. label Dec 9, 2023
@mroeschke mroeschke changed the title Fix DataFrame.reindex when reindexing to MultiIndex/RangeIndex Fix DataFrame.reindex when column reindexing to MultiIndex/RangeIndex Dec 9, 2023
df = self
else:
columns = as_index(columns)
intersection = self._data.to_pandas_index().intersection(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to have suggestion if there's a way to do this without dispatching to pandas. This was to ensure the MultiIndex intersection case worked correctly

Copy link
Contributor

@galipremsagar galipremsagar left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me

@mroeschke
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 8136a16 into rapidsai:branch-24.02 Dec 13, 2023
68 checks passed
@mroeschke mroeschke deleted the bug/reindex/columns_class branch December 13, 2023 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants