How do I filter an 2D array based on a value in a column?
I tried arr[arr[2] > 5]
but it fails
>>> arr = np.arange(12).reshape((4,3))
>>> print(arr)
[[ 0 1 2]
[ 3 4 5]
[ 6 7 8]
[ 9 10 11]]
>>> print(arr[arr[2] > 5])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: boolean index did not match indexed array along dimension 0; dimension is 4 but corresponding boolean dimension is 3
doh, i see now…
arr[arr[:,2] > 5]