Skip to content

BUG: Fix all-NaT when ArrowEA.astype to categorical #62055

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

arthurlw
Copy link
Member

@arthurlw arthurlw commented Aug 6, 2025

@arthurlw arthurlw changed the title BUG: Added condition for CategoricalDtype BUG: Fix all-NaY when ArrowEA.astype to categorical Aug 6, 2025
@arthurlw arthurlw changed the title BUG: Fix all-NaY when ArrowEA.astype to categorical BUG: Fix all-NaT when ArrowEA.astype to categorical Aug 6, 2025
dtype = pandas_dtype(dtype)
if dtype == self.dtype:
if not copy:
return self
else:
return self.copy()

if isinstance(dtype, CategoricalDtype):
Copy link
Member

Choose a reason for hiding this comment

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

Pretty weird to do this in the base class. Can you track down where the actual problem is? Could be hiding other bugs eg in categorical.fromsequence

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah okay i'll investigate further

if is_datetime64_any_dtype(cat_dtype) or is_timedelta64_dtype(
cat_dtype
):
values = values.to_numpy()
Copy link
Member

Choose a reason for hiding this comment

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

this can be expensive, particularly in dt64tz. have you figured out why the problem is happening? i.e. if you step through the code, where does the first wrong result show up

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.

BUG: ArrowEA.astype to categorical returning all-NaT
2 participants