Skip to content

Simplify categorical column - #20942

Merged
rapids-bot[bot] merged 9 commits into
NVIDIA:mainfrom
vyasr:refactor/simplify_categorical
Dec 24, 2025
Merged

Simplify categorical column#20942
rapids-bot[bot] merged 9 commits into
NVIDIA:mainfrom
vyasr:refactor/simplify_categorical

Conversation

@vyasr

@vyasr vyasr commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

Description

This PR makes CategoricalColumn.codes a trivial access to self.children[0], so there is no longer a separate self._codes attribute storing a masked version of the child column. With that change, we can also remove the need for to_pylibcudf to support the use_base parameter, which was only false to support setting the mask on the categorical codes due to the separation between the codes' mask and the categorical's mask. to_pylibcudf also no longer needs specialized handling for categorical columns since a simple override in CategoricalColumn is sufficient. Additionally, we can remove multiple overrides of parent methods from CategoricalColumn that only served to maintain the codes.

Checklist

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

@vyasr vyasr self-assigned this Dec 23, 2025
@vyasr
vyasr requested a review from a team as a code owner December 23, 2025 16:21
@vyasr vyasr added the improvement Improvement / enhancement to an existing function label Dec 23, 2025
@vyasr
vyasr requested a review from wence- December 23, 2025 16:21
@vyasr vyasr added the non-breaking Non-breaking change label Dec 23, 2025
@vyasr
vyasr requested a review from rjzamora December 23, 2025 16:21
@github-actions github-actions Bot added the Python Affects Python cuDF API. label Dec 23, 2025
@GPUtester GPUtester moved this to In Progress in cuDF Python Dec 23, 2025

@mroeschke mroeschke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The pandas tests failures may be real, but the changes LGTM

@vyasr

vyasr commented Dec 24, 2025

Copy link
Copy Markdown
Contributor Author

The pandas tests failures may be real, but the changes LGTM

They are real indeed. Took some doing to track down, but it's good they failed since it's a bug we really should be catching in our own test suite. Fixed.

@github-actions github-actions Bot added the cudf.pandas Issues specific to cudf.pandas label Dec 24, 2025
@vyasr

vyasr commented Dec 24, 2025

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit d9b3a14 into NVIDIA:main Dec 24, 2025
136 of 137 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Dec 24, 2025
@vyasr
vyasr deleted the refactor/simplify_categorical branch December 24, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cudf.pandas Issues specific to cudf.pandas improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants