numpy.repeat TypeError: array cannot be safely cast to required type

George Sakkis george.sakkis at gmail.com
Fri Nov 3 13:10:54 CST 2006


Can anyone explain this ?

>>> import numpy as N
>>> x = N.arange(1,6,dtype='B')
>>> x
array([1, 2, 3, 4, 5], dtype=uint8)
>>> N.repeat(x, N.ones(5,'H'))
array([1, 2, 3, 4, 5], dtype=uint8)
>>> N.repeat(x, N.ones(5,'l'))
array([1, 2, 3, 4, 5], dtype=uint8)
>>> N.repeat(x, N.ones(5,'L'))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/usr/local/lib/python2.4/site-packages/numpy/core/fromnumeric.py",
line 83, in repeat
    return repeat(repeats, axis)
TypeError: array cannot be safely cast to required type

Thanks,
George


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list