On Sat, Apr 12, 2014 at 5:03 PM, Sebastian Berg <[email protected]>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? > > > > 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. The "set routines" [1] are in this category and may help you deal with partitions, but I would recommend using boolean arrays instead. If you commonly deal with both a subset and a complement, set representation does not give you a memory advantage over a boolean mask. [1] http://docs.scipy.org/doc/numpy/reference/routines.set.html
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
