[Numpy-discussion] View ND Homogeneous Record Array as (N+1)D Array?
Alexander Michael
lxander.m@gmail....
Mon Mar 17 15:44:34 CDT 2008
Is there a way to view an N-dimensional array with a *homogeneous*
record dtype as an array of N+1 dimensions? An example will make it
clear:
import numpy
a = numpy.array([(1.0,2.0), (3.0,4.0)], dtype=[('A',float),('B',float)])
b = a.view(...) # do something magical
print b
array([[ 1., 2.],
[ 3., 4.]])
b[0,0] = 0.0
print a
[(0.0, 2.0) (3.0, 4.0)]
Thanks,
Alex
More information about the Numpy-discussion
mailing list