-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX Convert boolean pd.Series to boolean ndarrays #25147
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 Convert boolean pd.Series to boolean ndarrays #25147
Conversation
For types that are not pandas extension dtypes, we should ask numpy to tell us the best dtype, so that we preserve the behaviour of boolean Series being converted to boolean arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! This needs a whats_new entry in 1.2.1.
Comments done and what's new added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update! LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is complex but I am not sure how to do better. Also it matches what the docstring says for dtype="numeric"
which is the default so LGTM.
Thanks for the fix.
For types that are not pandas extension dtypes, we should ask numpy to tell us the best dtype, so that we preserve the behaviour of boolean Series being converted to boolean arrays.
The story is a bit confused by categorical dtypes :-/ So while this fixes the regression and doesn't break any existing tests in
test_validation.py
, it feels like we are adding a layer on top of several layers of "fixes" and exceptions in the conversion logic. Ideas welcome.Closes #25145