[SciPy-User] What "Array" means

Sturla Molden sturla at molden.no
Sun Apr 10 21:36:11 EDT 2011


Den 08.04.2011 12:14, skrev Timothy Wu:
>
> File "/usr/lib/python2.6/dist-packages/scipy/stats/mstats_basic.py", 
> line 1546, in kurtosistest
>     n = a.count(axis=axis).astype(float)
> AttributeError: 'int' object has no attribute 'astype'
>
> I'm not familiar with numpy nor scipy. What exactly should I put in there?

I find multiple cases of code like this:

a, axis = _chk_asarray(a, axis)
n = a.count(axis)

a, axis = _chk_asarray(a, axis)
n = a.count(axis=axis)

a, axis = _chk_asarray(a, axis)
n = a.count(axis)

a, axis = _chk_asarray(a, axis)
n = a.count(axis=axis).astype(float)


All of them are bugs:

_chk_asarray sometimes returns an ndarray (due to np.ma.ravel), which 
does not have a count attribute.

Sometimes count returns an int, which does not have an asfloat attribute.


Sturla





More information about the SciPy-User mailing list