[Numpy-discussion] Structured array inititialization weirdness
Erik Tollerud
erik.tollerud@gmail....
Sat Jun 20 12:04:03 CDT 2009
I've encountered an odd error I don't understand (see the case below):
the first structured array ("A" in the example) initializes from a
list of length-2 arrays with no problem, but if I give it a 2-by-2
array ("B"), it raises a TypeError... Why would it be any different to
convert the first index of the array into a list?
>>> from numpy import *
>>> from numpy.random import *
>>> dt=dtype([('a','f'),('b','f')])
>>> A=array(list(randn(2,10)),dtype=dt)
>>> B=array(randn(2,10),dtype=dt)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: expected a readable buffer object
More information about the Numpy-discussion
mailing list