diff options
author | Loïc Estève <loic.esteve@ymail.com> | 2016-09-07 13:58:59 +0200 |
---|---|---|
committer | Loïc Estève <loic.esteve@ymail.com> | 2016-09-07 19:09:30 +0200 |
commit | ed300480512029be7fbd031251a280964341acfe (patch) | |
tree | 3ffc66bd5b44c780ed539bc47473408962b6bfb8 /numpy/ma/extras.py | |
parent | 96025b94ba3e7e38188de2bc224cde8df2ef5476 (diff) | |
download | numpy-ed300480512029be7fbd031251a280964341acfe.tar.gz |
BUG: fix np.ma.median with only one non-masked value
and an axis argument. Add test.
Diffstat (limited to 'numpy/ma/extras.py')
-rw-r--r-- | numpy/ma/extras.py | 3 |
1 files changed, 1 insertions, 2 deletions
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)] |