[Numpy-discussion] how to find array indices at which a condition is satisfied?

Stéfan van der Walt stefan at sun.ac.za
Thu Aug 20 21:06:30 EDT 2009


2009/8/20 Dr. Phillip M. Feldman <pfeldman at verizon.net>:
>
> I have a 1-D array and would like to generate a list of indices for which a
> given condition is satisfied.  What is the cleanest way to do this?

np.where(x > 0)

Stéfan



More information about the NumPy-Discussion mailing list