Skip to content

BUG: dictionary type astype categorical using dictionary as categories #56672

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

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 28, 2023

Currently, we use a dictionary array as categories, which is weird, this just uses the underlying dictionary and extracts the codes, which should be fine for us. The dictionary array causes all kinds of trouble when sorting and doing similar things

@phofl phofl requested a review from mroeschke December 28, 2023 22:39
@phofl phofl added Arrow pyarrow functionality Categorical Categorical Data Type labels Dec 28, 2023
Copy link
Member

@WillAyd WillAyd 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. Is this only an issue during construction/astype?

@phofl
Copy link
Member Author

phofl commented Jan 3, 2024

We use arrow to cast on construction which does this properly, so we should be good,

@phofl phofl added this to the 2.2 milestone Jan 3, 2024
@phofl phofl merged commit 1dcdffd into pandas-dev:main Jan 3, 2024
@phofl phofl deleted the cat_astype branch January 3, 2024 22:49
meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Jan 3, 2024
mroeschke pushed a commit that referenced this pull request Jan 3, 2024
…orical using dictionary as categories) (#56723)

Backport PR #56672: BUG: dictionary type astype categorical using dictionary as categories

Co-authored-by: Patrick Hoefler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Categorical Categorical Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants