Skip to content

ENH: axis=None option for statistical methods: .min, .max, .median, and so on #43889

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

Closed
brynhayder opened this issue Oct 5, 2021 · 3 comments
Labels
API Design Enhancement Needs Discussion Requires discussion from core team before further action Reduction Operations sum, mean, min, max, etc.

Comments

@brynhayder
Copy link

I am a long time user of pandas, thank you for all your hard work.

Is your feature request related to a problem?

It would be useful to be able to do df.min(axis=None) rather than df.values.min(axis=None) to get the mimum over the whole DataFrame. The same goes for max and so on. I expected this to work since this is how any and all work.

Describe the solution you'd like

I'd like the default argument for axis to be 0 and then change the behaviour of None to do both axes, like numpy does. This would be then be consistent with .all and .any.

Maybe changing behaviour of axis=None would be an issue, if so, maybe this would require the less desirable axis="both".

API breaking implications

This would make the API more consitent, but would also be a breaking change.

Describe alternatives you've considered

Writing df.values.min(None).

@brynhayder brynhayder added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 5, 2021
@brynhayder brynhayder changed the title ENH: axis=None option for statistical methods: .min, .max, .median, and so on ENH: axis=None option for statistical methods: .min, .max, .median, and so on Oct 5, 2021
@jbrockmendel jbrockmendel added the Reduction Operations sum, mean, min, max, etc. label Oct 6, 2021
@mroeschke mroeschke added Needs Discussion Requires discussion from core team before further action API Design and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 13, 2021
@jbrockmendel
Copy link
Member

PR would be welcome.

@vyasr
Copy link
Contributor

vyasr commented Dec 7, 2022

@jbrockmendel I think this issue can be closed as a duplicate since the request is a subset of #21597.

@jbrockmendel
Copy link
Member

closing as duplicate of #21597.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Enhancement Needs Discussion Requires discussion from core team before further action Reduction Operations sum, mean, min, max, etc.
Projects
None yet
Development

No branches or pull requests

4 participants