[Numpy-discussion] index partition

Alan G Isaac alan.isaac at gmail.com
Sat Apr 12 16:47:19 EDT 2014

 From a 1d array, I want two arrays of indexes:
the first for elements that satisfy a criterion,
and the second for elements that do not.  Naturally
there are many ways to do this.  Is there a preferred way?

As a simple example, suppose for array `a` I want
np.flatnonzero(a>0) and np.flatnonzero(a<=0).
Can I get them both in one go?

Alan Isaac

More information about the NumPy-Discussion mailing list