[Numpy-discussion] Applying argwhere to an array
Fri Nov 20 01:21:20 CST 2009
So if I have a 2-dimensional array, and I want to return the indexes
of all the elements that are larger than some value, then I just use
np.argwhere(d > 1) or something, where d is the array. However, is
there anything I can do that's similar, but return the indexes of the
elements that are larger than a value, where the value depends on the
column index? Like if the column index is less than 5 then do
np.argwhere(d > 1) and np.argwhere(d > 2) otherwise. I know I can
split up the array and then apply these on both arrays, but then I end
up with an unsorted list if I want the indexes to be sorted by rows,
so I'd have to deal with that also, which would take up a lot of time.
So if anyone knows what I should do, that would be great. Thanks.
More information about the NumPy-Discussion