8000 masked-array median of array should be scalar · Issue #7835 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

masked-array median of array should be scalar #7835

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
larrybradley opened this issue Jul 14, 2016 · 1 comment
Closed

masked-array median of array should be scalar #7835

larrybradley opened this issue Jul 14, 2016 · 1 comment

Comments

@larrybradley
Copy link
Contributor
larrybradley commented Jul 14, 2016

Related to #5969, #7592, #7635, #7654, I still find inconsistent behavior in numpy 1.11.1.
np.ma.median (with axis=None) returns a masked array instead of a scalar for all cases except when the input is a masked array that has a least one masked value. It's only for that case where a scalar is returned.

>>> data = np.arange(10)
>>> mask = np.zeros(10).astype(bool)
>>> np.ma.median(data)
masked_array(data = 4.5,
             mask = False,
       fill_value = 1e+20)

>>> np.ma.median(np.ma.masked_array(data, mask=False))
masked_array(data = 4.5,
             mask = False,
       fill_value = 1e+20)

>>> np.ma.median(np.ma.masked_array(data, mask=mask))
masked_array(data = 4.5,
             mask = False,
       fill_value = 1e+20)

>>> mask[0] = True
>>> np.ma.median(np.ma.masked_array(data, mask=mask))
5.0
@larrybradley larrybradley changed the title masked-array median of 1d array should be scalar masked-array median of array should be scalar Jul 14, 2016
@charris charris added this to the 1.11.2 release milestone Jul 20, 2016
@ahaldane ahaldane closed this as completed Aug 8, 2016
@ahaldane
Copy link
Member
ahaldane commented Aug 8, 2016

Fixed by #7911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0