Thanks to visit codestin.com
Credit goes to github.com

Skip to content

min/max/mean of empty arrays (Trac #2078) #2670

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
numpy-gitbot opened this issue Oct 19, 2012 · 7 comments
Closed

min/max/mean of empty arrays (Trac #2078) #2670

numpy-gitbot opened this issue Oct 19, 2012 · 7 comments
Labels
00 - Bug component: numpy._core Priority: high High priority, also add milestones for urgent issues
Milestone

Comments

@numpy-gitbot
Copy link

Original ticket http://projects.scipy.org/numpy/ticket/2078 on 2012-03-11 by trac user muellner, assigned to unknown.

[]In NumPy release 1.5.1, the minimum/maximum/mean of empty arrays is handled in a sensible way, namely by returning an empty array:

>>> numpy.min(numpy.zeros((0,2)), axis=1)
array([], dtype=float64)

Likewise for max and mean.

This behavior is broken in NumPy 1.7.0.dev-56f66bb, and the line above raises a ValueError. Is this a bug or a feature? Personally, I prefer the old behavior, as it allows the easy handling of special cases (zero-sized arrays) without the need for extra checks.

@numpy-gitbot
Copy link
Author

@charris wrote on 2012-03-11

It would be good to post this question on the numpy mailing list. The handling of empty arrays is something we want to sort out and it would be good to discuss this there.

@numpy-gitbot
Copy link
Author

@mwiebe wrote on 2012-03-12

This makes sense to me, it probably changed when I rewrote the ufunc 'reduce' method to optimize its cache-coherency and add NA support. I'm not sure if it's flogging a dead horse to mention that there should have been a unit test for this so it would have been caught during development instead of now.

@numpy-gitbot
Copy link
Author

Milestone changed to NumPy 1.7 by @mwiebe on 2012-03-12

@numpy-gitbot
Copy link
Author

@charris wrote on 2012-03-12

I think that horse is now one of undead.

@numpy-gitbot
Copy link
Author

@njsmith wrote on 2012-05-20

A patch is here, but not making a PR yet because there is a traffic jam there. I'd rather not have 3 conflicting PRs all outstanding at once :-) So noting to make sure it won't get lost.

njsmith@a0448b8

@numpy-gitbot
Copy link
Author

@njsmith wrote on 2012-06-27

#323

@numpy-gitbot
Copy link
Author

@rgommers wrote on 2012-07-15

PR was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug component: numpy._core Priority: high High priority, also add milestones for urgent issues
Projects
None yet
Development

No branches or pull requests

1 participant