Logic functions

Truth value testing

all(a[, axis, out]) Test whether all array elements along a given axis evaluate to True.
any(a[, axis, out]) Test whether any array element along a given axis evaluates to True.

Array contents

isfinite() Test element-wise for finite-ness (not infinity or not Not a Number).
isinf() Test element-wise for positive or negative infinity.
isnan() Test element-wise for Not a Number (NaN), return result as a bool array.
isneginf(x[, y]) Test element-wise for negative infinity, return result as bool array.
isposinf(x[, y]) Test element-wise for positive infinity, return result as bool array.

Array type testing

iscomplex(x) Returns a bool array, where True if input element is complex.
iscomplexobj(x) Return True if x is a complex type or an array of complex numbers.
isfortran(a) Returns True if array is arranged in Fortran-order in memory
isreal(x) Returns a bool array, where True if input element is real.
isrealobj(x) Return True if x is a not complex type or an array of complex numbers.
isscalar(num) Returns True if the type of num is a scalar type.

Logical operations

logical_and(x1) Compute the truth value of x1 AND x2 elementwise.
logical_or(x1) Compute the truth value of x1 OR x2 elementwise.
logical_not() Compute the truth value of NOT x elementwise.
logical_xor(x1) Compute the truth value of x1 XOR x2, element-wise.

Comparison

allclose(a, b[, rtol, atol]) Returns True if two arrays are element-wise equal within a tolerance.
array_equal(a1, a2) True if two arrays have the same shape and elements, False otherwise.
array_equiv(a1, a2) Returns True if input arrays are shape consistent and all elements equal.
greater(x1) Return the truth value of (x1 > x2) element-wise.
greater_equal(x1) Return the truth value of (x1 >= x2) element-wise.
less(x1) Return the truth value of (x1 < x2) element-wise.
less_equal(x1) Return the truth value of (x1 =< x2) element-wise.
equal(x1) Return (x1 == x2) element-wise.
not_equal(x1) Return (x1 != x2) element-wise.

Table Of Contents

Previous topic

numpy.extract

Next topic

numpy.all

This Page