-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Closed
Labels
Description
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