[Numpy-discussion] index partition
sebastian at sipsolutions.net
Sat Apr 12 17:03:45 EDT 2014
On Sa, 2014-04-12 at 16:47 -0400, Alan G Isaac wrote:
> 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?
Might be missing something, but I don't think there is a way to do it in
one go. The result is irregularly structured and there are few functions
like nonzero which give something like that.
> Alan Isaac
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
More information about the NumPy-Discussion