[SciPy-User] nanmedian chokes on size zero arrays

Keith Goodman kwgoodman at gmail.com
Wed Mar 2 15:27:36 EST 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)
<snip>
IndexError: invalid index

Anyone know a fix? Here's the ticket:
http://projects.scipy.org/scipy/ticket/1400



More information about the SciPy-User mailing list