From ed300480512029be7fbd031251a280964341acfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 7 Sep 2016 13:58:59 +0200 Subject: BUG: fix np.ma.median with only one non-masked value and an axis argument. Add test. --- numpy/ma/extras.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'numpy/ma/extras.py') diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 0d5c73e7e..e4ff8ef2d 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -727,9 +727,8 @@ def _median(a, axis=None, out=None, overwrite_input=False): ind = np.meshgrid(*axes_grid, sparse=True, indexing='ij') # insert indices of low and high median - ind.insert(axis, h - 1) + ind.insert(axis, np.maximum(0, h - 1)) low = asorted[tuple(ind)] - low._sharedmask = False ind[axis] = h high = asorted[tuple(ind)] -- cgit v1.2.1