I have the following code:
# unicorns is a numpy array with several fields
idx = (1, 2, 3, 5, 7)
unicorns=uni[idx]
# now i have only the first, second, third, ... unicorn
print unicorns
However if I want to subselect this unicorn array
unicorns['color'=='white']['Name']
which should give me the names of the unicorns that are white, numpy interprets only
the color==white part as False, which goes to 0 and it returns the first entry of my array.
How can I fix this code, so that it does what I want it to, selecting the white unicorns?
I would prefer everything stays as numpy, so I can also select other properties oft the unicorns.
Edit
Here is an example for the arrays:
unicorns=[(1, black, 0.0, 'Pinky', 1) (2, black, 0.0, 'Winky', 1)
(3, white, 0.0, 'Lala', 1) (4, white, 0.0, 'Merlin', 1)
(5, black, 0.0, 'Meriva', 1) (6, white, 0.0, 'Panda', 1)]
idx = [ 0 , 3 , 6 ]
unicornsthat can be used to reproduce the problem?