[Numpy-discussion] index partition
Sebastian Berg
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.
- Sebastian
> Thanks,
> Alan Isaac
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list