w3resource

NumPy: Logic functions routines

Logic functions routines

Truth value testing
Name Description Syntax
all() Test whether all array elements along a given axis evaluate to True. numpy.all(a, axis=None, out=None, keepdims=<no value>)
any() Test whether any array element along a given axis evaluates to True. numpy.any(a, axis=None, out=None, keepdims=<no value>)
Array contents
Name Description Syntax
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]) = <ufunc 'isfinite'>
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]) = <ufunc 'isinf'>
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]) = <ufunc 'isnan'>
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]) = <ufunc 'isnat'>
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
Name Description Syntax
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
Name Description Syntax
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]) = <ufunc 'logical_and'>
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]) = <ufunc 'logical_or'>
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]) = <ufunc 'logical_not'>
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]) = <ufunc 'logical_xor'>
Comparison
Name Description Syntax
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]) = <ufunc 'greater'>
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]) = <ufunc 'greater_equal'>
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]) = <ufunc 'less'>
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]) = <ufunc 'less_equal'>
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]) = <ufunc 'equal'>
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]) = <ufunc 'not_equal'>

Previous: NumPy ndarray
Next: all() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/numpy/logic-functions/index.php