In the section Accessing multiple fields at once of numpy docs, says that:
Notice that the fields are always returned in the same order regardless of the sequence they are asked for.
The docs also give a example as following:
>>> x = np.array([(1.5,2.5,(1.0,2.0)),(3.,4.,(4.,5.)),(1.,3.,(2.,6.))],
dtype=[('x','f4'),('y',np.float32),('value','f4',(2,2))])
>>> x[['x','y']]
array([(1.5, 2.5), (3.0, 4.0), (1.0, 3.0)],
dtype=[('x', '<f4'), ('y', '<f4')])
>>> x[['y','x']]
array([(1.5, 2.5), (3.0, 4.0), (1.0, 3.0)],
dtype=[('x', '<f4'), ('y', '<f4')])
However, I have run the code myself with numpy 1.6.1 and got a different result:
In [20]: x = np.array([(1.5,2.5,(1.0,2.0)),(3.,4.,(4.,5.)),(1.,3.,(2.,6.))],
....: dtype=[('x','f4'),('y',np.float32),('value','f4',(2,2))])
In [21]: x[['x','y']]
Out[21]:
array([(1.5, 2.5), (3.0, 4.0), (1.0, 3.0)],
dtype=[('x', '<f4'), ('y', '<f4')])
In [22]: x[['y','x']]
Out[22]:
array([(2.5, 1.5), (4.0, 3.0), (3.0, 1.0)],
dtype=[('y', '<f4'), ('x', '<f4')])
Did this behavior changed from numpy 1.6 to 1.7 or I have missed something?
EDIT I have tested the code in numpy 1.7.1, the result was the same as numpy 1.6.