[Numpy-discussion] Are there command similar as Matlab find command?
Travis E. Oliphant
Mon Sep 29 16:48:23 CDT 2008
frank wang wrote:
> I am trying to find a command in numpy or python that perform similar
> function as Matlab find command. It will return the indexes of array
> that satisfy a condition. So far I have not found anything.
There are several ways to do this, but what are you trying to do?
Non-zero on the boolean array resulting from the condition is the most
This returns a tuple of indices of length nd, where nd is the number of
dimensions of a. (i.e. for 1-d case you need to extract the first
element of the tuple to get the indices you want).
But, if you are going to use these indices to access elements of the
array, there are better ways to do that:
More information about the Numpy-discussion