[Numpy-discussion] index partition

Alexander Belopolsky ndarray at mac.com
Sat Apr 12 17:01:42 EDT 2014

On Sat, Apr 12, 2014 at 4:47 PM, Alan G Isaac <alan.isaac at gmail.com> wrote:

> 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?

I don't think you can do better than

x = a > 0
p, q = np.flatnonzero(x), np.flatnonzero(~x)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140412/341680ea/attachment.html>

More information about the NumPy-Discussion mailing list