[SciPy-Dev] nanstd chokes on negative axis
Keith Goodman
kwgoodman@gmail....
Wed Apr 21 19:58:53 CDT 2010
nanstd chokes on negative axis because of these two lines:
shape = np.arange(x.ndim).tolist()
shape.remove(axis)
Example:
>> from scipy.stats import nanstd
>> x = np.array([1,2,3])
>> nanstd(x) # <--- good
1.0
>> nanstd(x, axis=0) # <--- good
1.0
>> nanstd(x, axis=-1) # <--- BAD
---------------------------------------------------------------------------
ValueError: list.remove(x): x not in list
Suggested fix:
shape = range(x.ndim)
shape.remove(shape[axis])
Ticket:
http://projects.scipy.org/scipy/ticket/1161
More information about the SciPy-Dev
mailing list