summaryrefslogtreecommitdiff
path: root/numpy/lib/nanfunctions.py
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2016-12-17 13:07:34 +0100
committerJulian Taylor <jtaylor.debian@googlemail.com>2016-12-17 13:07:34 +0100
commit7434633ff336917d3ded804aeb0e5695c6bd806a (patch)
treefa8e62505e3512a8cf12196b509893f3dbcbbefc /numpy/lib/nanfunctions.py
parent2a1e5a6d2ffdabf2a18875ee8dd57773d608e4c5 (diff)
downloadnumpy-7434633ff336917d3ded804aeb0e5695c6bd806a.tar.gz
ENH: retune apply_along_axis nanmedian cutoff
Old value was erroneously obtained on a sorted array which is a best case for the median of 3 pivoted introsort.
Diffstat (limited to 'numpy/lib/nanfunctions.py')
-rw-r--r--numpy/lib/nanfunctions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py
index 812b9bcb3..9b9df77c3 100644
--- a/numpy/lib/nanfunctions.py
+++ b/numpy/lib/nanfunctions.py
@@ -869,7 +869,8 @@ def _nanmedian(a, axis=None, out=None, overwrite_input=False):
else:
# for small medians use sort + indexing which is still faster than
# apply_along_axis
- if a.shape[axis] < 1000:
+ # benchmarked with shuffled (50, 50, x) containing a few NaN
+ if a.shape[axis] < 600:
return _nanmedian_small(a, axis, out, overwrite_input)
result = np.apply_along_axis(_nanmedian1d, axis, a, overwrite_input)
if out is not None: