Skip to content

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

Merged
merged 3 commits into from
Oct 2, 2020
Merged

ENH: Implement IntegerArray reductions #36761

merged 3 commits into from
Oct 2, 2020

Conversation

dsaxton
Copy link
Member

@dsaxton dsaxton commented Oct 1, 2020

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.)

@dsaxton dsaxton added Enhancement NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Oct 1, 2020
return super()._reduce("sum", skipna=skipna, min_count=min_count)

def prod(self, skipna=True, min_count=0, **kwargs):
nv.validate_sum((), kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

validate_prod?

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a 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)

@jreback jreback added this to the 1.2 milestone Oct 2, 2020
return super()._reduce("sum", skipna=skipna, min_count=min_count)

def prod(self, skipna=True, min_count=0, **kwargs):
nv.validate_prod((), kwargs)
Copy link
Contributor

@jreback jreback Oct 2, 2020

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

Copy link
Member Author

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)

Copy link
Contributor

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.

@jreback jreback merged commit cf6ad46 into pandas-dev:master Oct 2, 2020
@dsaxton dsaxton deleted the integer-array-min-max-prod branch October 2, 2020 21:46
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement NA - MaskedArrays Related to pd.NA and nullable extension arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants