Skip to content

Support DataFrame.astype('category') #559

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 4 commits into from
Mar 3, 2023
Merged

Support DataFrame.astype('category') #559

merged 4 commits into from
Mar 3, 2023

Conversation

zmoon
Copy link
Contributor

@zmoon zmoon commented Mar 2, 2023

@zmoon
Copy link
Contributor Author

zmoon commented Mar 2, 2023

I don't think my test is testing the right thing, since it passed (locally) before I added CategoryDtypeArg to AstypeArg. I'm guessing I need to add something somewhere else too?

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

Can you add a test in test_frame.py:test_astype that tests DataFrame.astype("category") and DataFrame.astype(CategoricalDtype()) since that was the original report (i.e., category didn't work for DataFrame)?

@zmoon zmoon changed the title Add test for Series as CategoricalDtype Support DataFrame.astype('category') Mar 2, 2023
@zmoon zmoon marked this pull request as ready for review March 2, 2023 22:47
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

Thanks @zmoon

@Dr-Irv Dr-Irv merged commit 08d627b into pandas-dev:main Mar 3, 2023
@zmoon
Copy link
Contributor Author

zmoon commented Mar 3, 2023

Thanks @Dr-Irv for your help!

@zmoon zmoon deleted the astype-category branch March 3, 2023 04:33
twoertwein pushed a commit to twoertwein/pandas-stubs that referenced this pull request Apr 1, 2023
* Add test for Series as CategoricalDtype

* Add `CategoryDtypeArg` to `AstypeArg`

* Apply review suggestions

* Add test for `DataFrame.astype('category')`
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.

DataFrame.astype('category') currently not supported
2 participants