-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
BUG: Fix cast_pointwise_result with all-NA values #62352
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
Conversation
Whether to convert datetime, timedelta, period, interval types. | ||
dtype_if_all_na : np.dtype, ExtensionDtype, or None, default None | ||
Dtype to cast to if we have all-NA or all-None. | ||
dtype_if_all_nat : np.dtype, ExtensionDtype, or None, default None |
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.
can this replace dtype_if_all_nat instead of adding a new arg?
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.
never mind, i now see that isnt viable.
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.
Yes, It seems not easy. the details are above. #62352 (comment)
There will be pros and cons, but I think the logic of _cast_pointwise_result
is that the current version is clearer. (d5c6cfb)
This reverts commit d5c6cfb.
thanks @heoh |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Description
Fix a bug in
BaseMaskedArray._cast_pointwise_result
with all-NA values results returnedobject
dtype instead of preserving the original dtype.Additional Notes
In the original issue report the behavior was described for
BooleanDtype
. While preparing the fix, I added tests not only forBooleanDtype
but also for integer dtype under the same all-NA condition. I thought it would be reasonable to ensure consistency across multiple ExtensionArray types.If this is out of scope or unnecessary for this PR, please let me know and I will modify the test for only the Boolean case, as reported in the issue.