-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Implement IntegerArray reductions #36761
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
pandas/core/arrays/integer.py
Outdated
return super()._reduce("sum", skipna=skipna, min_count=min_count) | ||
|
||
def prod(self, skipna=True, min_count=0, **kwargs): | ||
nv.validate_sum((), kwargs) |
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.
validate_prod?
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.
Thanks, looks good to me (just the comment of Brock)
return super()._reduce("sum", skipna=skipna, min_count=min_count) | ||
|
||
def prod(self, skipna=True, min_count=0, **kwargs): | ||
nv.validate_prod((), kwargs) |
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.
why can't we do this like sum?
I would rather fix this generally
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 thought this was cleaner because it removed code duplication between here and BaseMaskedArray (which is already using masked_reductions)
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.
oh ic, ok then. yeah let's merge this and FloatingArray, then pls de-duplicate what you can.
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
I'm not sure if this is the "best" way to implement these reductions (see linked issue), but in any case I figure this is better than nothing since we can get these reductions pretty much for free. As far as I can tell FloatingArray can use the same machinery.
(I'm not able to pass on kwargs here because the masked reductions don't take them all, e.g.
axis
, and various tests break as a result.)