8000 STY: ma.extras.median: avoid indexing with list · charris/numpy@1f80666 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f80666

Browse files
AmitAronovitchcharris
authored andcommitted
STY: ma.extras.median: avoid indexing with list
Recommended type for nd-indexing is a tuple. See numpy#4434
1 parent c1153b8 commit 1f80666

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

numpy/ma/extras.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,10 @@ def median(a, axis=None, out=None, overwrite_input=False):
692692
ind = np.meshgrid(*axes_grid, sparse=True, indexing='ij')
693693
# insert indices of low and high median
694694
ind.insert(axis, h - 1)
695-
low = asorted[ind]
695+
low = asorted[tuple(ind)]
696696
low._sharedmask = False
697697
ind[axis] = h
698-
high = asorted[ind]
698+
high = asorted[tuple(ind)]
699699
# duplicate high if odd number of elements so mean does nothing
700700
odd = counts % 2 == 1
701701
if asorted.ndim == 1:

0 commit comments

Comments
 (0)
0