# NumPy: Logic functions routines

## Logic functions routines

Name Description Syntax Truth value testing all() Test whether all array elements along a given axis evaluate to True. numpy.all(a, axis=None, out=None, keepdims=) any() Test whether any array element along a given axis evaluates to True. numpy.any(a, axis=None, out=None, keepdims=) Array contents isfinite() Test element-wise for finiteness (not infinity or not Not a Number). numpy.isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = isinf() Test element-wise for positive or negative infinity. numpy.isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = isnan() Test element-wise for NaN and return result as a boolean array. numpy.isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = isnat() Test element-wise for NaT (not a time) and return result as a boolean array. numpy.isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = isneginf() Test element-wise for negative infinity, return result as bool array. numpy.isneginf(x, out=None) isposinf() Test element-wise for positive infinity, return result as bool array. numpy.isposinf(x, out=None) Array type testing iscomplex() Returns a bool array, where True if input element is complex. numpy.iscomplex(x) iscomplexobj() Check for a complex type or an array of complex numbers. numpy.iscomplexobj(x) isfortran() Returns True if the array is Fortran contiguous but not C contiguous. numpy.isfortran(a) isreal() Returns a bool array, where True if input element is real. numpy.isreal(x) isrealobj() Return True if x is a not complex type or an array of complex numbers. numpy.isrealobj(x) isscalar() Returns True if the type of num is a scalar type. numpy.isscalar(num) Logical operations logical_and() Compute the truth value of x1 AND x2 element-wise. numpy.logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = logical_or() Compute the truth value of x1 OR x2 element-wise. numpy.logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = logical_not() Compute the truth value of NOT x element-wise. numpy.logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = logical_xor() Compute the truth value of x1 XOR x2, element-wise. numpy.logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = Comparison allclose() Returns True if two arrays are element-wise equal within a tolerance. numpy.allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False) isclose() Returns a boolean array where two arrays are element-wise equal within a tolerance. numpy.isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False) array_equal() True if two arrays have the same shape and elements, False otherwise. numpy.array_equal(a1, a2) array_equiv() Returns True if input arrays are shape consistent and all elements equal. numpy.array_equiv(a1, a2) greater() Return the truth value of (x1 > x2) element-wise. numpy.greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = greater_equal() Return the truth value of (x1 >= x2) element-wise. numpy.greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = less() Return the truth value of (x1 < x2) element-wise. numpy.less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = less_equal() Return the truth value of (x1 =< x2) element-wise. numpy.less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = equal() Return (x1 == x2) element-wise. numpy.equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = not_equal() Return (x1 != x2) element-wise. numpy.not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) =

Previous: NumPy ndarray
Next: all() function

﻿