[SciPy-user] Bug in scipy.stats skew, kurtosis

Wes McKinney wesmckinn@gmail....
Thu Oct 2 13:18:45 CDT 2008

Right now scipy.stats.skew (normal) and scipy.stats.kurtosis (fisher =
False) applied to a 1-dimensional array return an ndarray of the single
value with no dimensions.

In [13]: scipy.stats.skew([1,2,3,4,5])
Out[13]: array(0.0)

I am using Scipy 0.6, but I looked at the latest SVN and this behavior has
not changed. It's being caused by these lines:

m2 = moment(a, 2, axis)
m3 = moment(a, 3, axis)
zero = (m2 == 0)
vals = np.where(zero, 0, m3 / m2**1.5)

when the condition is not an array in numpy.where, the result is this 0-dim
array. Not sure if this is a SciPy issue or a numpy issue. If it's a Scipy
issue I can put in a ticket for this. I am using a workaround for now (check
if the result of the calc is an array and has no shape, if so cast to float)
but this seems like a bug.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20081002/79207183/attachment.html 

More information about the SciPy-user mailing list