Closed
Description
Recently upgraded from 1.9.3 to 1.10.0 in Python 2.7 (but I get the same behavior in Python 3.5 on both Mac and Linux).
In 1.9.3, running np.median(np.array([]))
produces a NaN and a warning of warnings.warn("Mean of empty slice.", RuntimeWarning)
.
Meanwhile, in 1.10.0, I'm now getting
IndexError: index -1 is out of bounds for axis 0 with size 0
The traceback points to the line in
python2.7/site-packages/numpy/lib/function_base.pyc in _median(a, axis, out, overwrite_input):
-> 3138 n = np.isnan(part[..., -1])
Is this intended behavior now in 1.10.0? I could switch all my code over to using np.nanmedian
, which still produces the NaN result on empty arrays from 1.9.3, but this looks to be more of an accident/bug based on the tracebacks.