There seems to be a fundamental lack of understanding on my behalf when it
comes to dtypes and record arrays.
Please consider the following snippet:
import numpy as N
newtype = N.dtype([('x', N.float64), ('y', N.float64), ('z', N.float64)])
a = N.random.random((100,3))
a.dtype=newtype
b = N.column_stack([a['x'].ravel(), a['y'].ravel(), a['z'].ravel()])
b.dtype = newtype
--> ValueError: new type not compatible with array.
I don't understand two things about this:
i) the shape of a changes from (100,3) to (100,1) after assigning the dtype.
ii) the shape of b is obviously (100,3), so why can't I assign the new
dtype?
Could someone please point out the flaws in this approach?
Thanks much,
Jan
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion