[Numpy-discussion] converting standard array to record array
Tue Aug 30 15:34:18 CDT 2011
So i'm using numpy 1.6.0, and trying to convert a (4,4) numpy array of dtype
'f8' into a record array of this dtype:
dt = np.dtype([('mat','(4,4)f8')])
Here is the code snippet:
In : a = np.random.randn(4,4)
> In : a.view(dt)
and the resulting error:
ValueError: new type not compatible with array.
Can anyone shed some light for me on why this conversion is not possible?
It is certainly technically possible, since the memory layout of the two
arrays should be the same.
Can anyone recommend a better way to do this conversion?
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion