I came across this difficulty accessing multiple fields (columns)
input:
a = np.array([(1.0, 2,1),(3.0, 4,2),(9, 3,6)], dtype=[('x', float), ('y', float), ('z', float)])
a=np.reshape(a,(a.shape[0],-1))
a
output:
array([[(1.0, 2.0, 1.0)],
[(3.0, 4.0, 2.0)],
[(9.0, 3.0, 6.0)]],
dtype=[('x', '<f8'), ('y', '<f8'), ('z', '<f8')])
if i want to access the first column i can do:
in: a[:]['x']
out: array([[ 1.],
[ 3.],
[ 9.]])
but what is the right syntax if i want to access (for example) first an 3rd column? Something like
in: a[:]['x':'z']
obviously does not work