[Numpy-discussion] Applying logical operations along an axis of a boolean array?

Juan Nunez-Iglesias jni.soma at gmail.com
Mon Dec 18 06:23:51 EST 2017


Use “np.all” or “np.any”.

On 18 Dec 2017, 10:02 PM +1100, hanno_lists at gmx.net, wrote:
> Hi,
>
> is it possible, to apply a logical operation, such as AND or OR along a particular axis of a numpy array?
>
> Let's say I have an (n,m) array and I want to AND along the first axis, such that I get a (1,m) (or just (m,) dimensional array back. I looked at the documentation for np.logical_and and friends but couldn't find an axis keyword on the logical_xyz operations and nothing else seemed to fit.
>
> Thanks, and best regards,
> Hanno
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20171218/754cee92/attachment.html>


More information about the NumPy-Discussion mailing list