8000 masked median of empty dimension fails · Issue #8703 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

masked median of empty dimension fails #8703

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
juliantaylor opened this issue Feb 26, 2017 · 2 comments · Fixed by #8705
Closed

masked median of empty dimension fails #8703

juliantaylor opened this issue Feb 26, 2017 · 2 comments · Fixed by #8705

Comments

@juliantaylor
Copy link
Contributor
a = np.ma.masked_array(np.array([], dtype=float, ndmin=3))
np.ma.median(a, axis=2)

fails with

IndexError: index -1 is out of bounds for axis 2 with size 0

As integer indexing of empty slices does not work.
Normal median slices instead and returns the mean of an empty slice, so nan.

What should masked median return? a masked nan to somewhat match the normal median or an empty array again?

@juliantaylor juliantaylor added this to the 1.12.1 release milestone Feb 26, 2017
@charris
Copy link
Member
charris commented Feb 27, 2017

This is also an error in 1.11.3, so not a regression. I want to release 1.12.1 soon, so may not include a fix for this if it isn't ready.

@juliantaylor
Copy link
Contributor Author

hm that is a regression in 1.11.2, it does work in 1.11.1
there it returns nan, like the normal median so thats probably how we should fix it.

juliantaylor added a commit to juliantaylor/numpy that referenced this issue Feb 27, 2017
return nan as it did in 1.11 and same as normal median.
closes numpygh-8703
juliantaylor added a commit to juliantaylor/numpy that referenced this issue Feb 27, 2017
return nan as it did in 1.11 and same as normal median.
closes numpygh-8703
juliantaylor added a commit that referenced this issue Feb 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0