I've read in a datafile to an ndarray with this command:
data=np.genfromtxt('n.txt', delimiter='\t', dtype=[('paramname','S26'),
('study','S26'), ('class','S10'), ('count','f4'), ('average','f4'),
('sd','f4'))
I would like to filter the array to only rows where paramname == 'bmi'. What
would be the most elegant way of doing this? I found 1 way for doing this
but it doesn't look very efficient nor elegant.
bmidata=np.asarray([x for x in data if x['paramname']=='bmi'],
dtype=data.dtype)
any simpler ways?
Thanks,
Jan.
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion