I want to select only certain rows from a NumPy array based on the value in the second column. For example, this test array has integers from 1 to 10 in the second column.
This is two times faster than Amnon's variant for len(test)=1000:
wanted = (2,4,6) wanted2 = numpy.expand_dims(wanted, 1) print test[numpy.any(test[:, 1] == wanted2, 0), :]