summaryrefslogtreecommitdiff
path: root/numpy/ma/extras.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-09-07 12:38:23 -0500
committerGitHub <noreply@github.com>2016-09-07 12:38:23 -0500
commit3333e8b4a033f3a10c356d8731fc3867dbc97364 (patch)
tree4a0654f653b04a954e95d2f8eae49b4887543317 /numpy/ma/extras.py
parentb91e8d8f164731bb710cc1e5173cc8ec3f8fadf5 (diff)
parented300480512029be7fbd031251a280964341acfe (diff)
downloadnumpy-3333e8b4a033f3a10c356d8731fc3867dbc97364.tar.gz
Merge pull request #8030 from lesteve/fix-ma-median-with-only-one-non-masked-value
BUG: fix np.ma.median with only one non-masked value and an axis argument
Diffstat (limited to 'numpy/ma/extras.py')
-rw-r--r--numpy/ma/extras.py3
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)]