[SciPy-User] nanmedian chokes on size zero arrays

Keith Goodman kwgoodman@gmail....
Wed Mar 2 14:27:36 CST 2011

While fixing Bottleneck functions that can't handle size zero arrays
of various shapes, I noticed that scipy.stats.nanmedian chokes on
certain size zero arrays and axis combinations:

>> from scipy.stats import nanmedian
>> a = np.ones((0,2))
>> np.median(a, 1)
   array([], dtype=float64)
>> nanmedian(a, 1)
IndexError: invalid index

Anyone know a fix? Here's the ticket:

More information about the SciPy-User mailing list