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

Stéfan van der Walt stefan@sun.ac...
Thu Aug 20 20:06:30 CDT 2009


2009/8/20 Dr. Phillip M. Feldman <pfeldman@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