summaryrefslogtreecommitdiff
path: root/numpy/ma/extras.py
diff options
context:
space:
mode:
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)]