You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
np.ma.median returns masked_array; doesn't match example in docs #5969
On CentOS 6 64 with a conda python and numpy 1.9.2
# python
Python 2.7.9 |Continuum Analytics, Inc.| (default, Mar 9 2015, 16:20:48)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import numpy as np
>>> np.__version__
'1.9.2'
>>> x = np.ma.array(np.arange(8), mask=[0]*4 + [1]*4)
>>> np.ma.extras.median(x)
masked_array(data = [1.5],
mask = [False],
fill_value = 1e+20)
In addition to not matching the Example, I think this is also inconsistent with the return type text and with the behavior of other masked aggregate functions (np.ma.mean) which seems to just return a np.float64 on the same x.
Activity
rgommers commentedon Jun 15, 2015
That indeed looks inconsistent, would be good to make the behavior match the example again.
taldcroft commentedon Jun 20, 2015
I think this was introduced by #4760 @juliantaylor.
AmitAronovitch commentedon Apr 30, 2016
please review PR #7592
BUG: ma.median of 1d array should return a scalar
BUG: ma.median of 1d array should return a scalar