-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: cumulative functions with ea dtype not handling NA correctly and casting to object #39483
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
phofl
commented
Jan 30, 2021
- closes BUG: cumsum() shows inconsistent results in nullable dtype #39479
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
… casting to object
pandas/core/nanops.py
Outdated
@@ -1728,12 +1731,27 @@ def na_accum_func(values: ArrayLike, accum_func, *, skipna: bool) -> ArrayLike: | |||
result, dtype=orig_dtype | |||
) | |||
|
|||
elif skipna and not issubclass(values.dtype.type, (np.integer, np.bool_)): | |||
elif ( |
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.
i think maybe ok to have is_ea_dtype be a separate elif; much easier to rationalize here
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.
Could do it like that
More general solution is being worked on in #28509 (which doesn't mean a short term solution can't be merged, I didn't closely look at either PR, just noting) |
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
vals[mask] = mask_a | ||
result = accum_func(vals, axis=0) | ||
result[mask_copy] = mask_b | ||
result = sanitize_array(result, None, values.dtype) |
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.
sanitize_array is relatively heavy-weight. what cases is it handling?
@phofl closing as stale. #39483 (comment) needs addressing. reopen when ready. |