逻辑函数#

真值测试#

all(a[, axis, out, keepdims, where])

测试给定轴上的所有数组元素是否都评估为 True。

any(a[, axis, out, keepdims, where])

测试给定轴上的任何数组元素是否评估为 True。

数组内容#

isfinite(x, /[, out, where, casting, order, ...])

逐元素测试有限性(不是无穷大也不是非数值)。

isinf(x, /[, out, where, casting, order, ...])

逐元素测试正无穷或负无穷。

isnan(x, /[, out, where, casting, order, ...])

逐元素测试 NaN 并将结果作为布尔数组返回。

isnat(x, /[, out, where, casting, order, ...])

逐元素测试 NaT (非时间) 并将结果作为布尔数组返回。

isneginf(x[, out])

逐元素测试负无穷大,将结果作为布尔数组返回。

isposinf(x[, out])

逐元素测试正无穷大,将结果作为布尔数组返回。

数组类型测试#

iscomplex(x)

返回一个布尔数组,如果输入元素是复数,则为 True。

iscomplexobj(x)

检查是否为复数类型或复数数组。

isfortran(a)

检查数组是否为 Fortran 连续但*不是* C 连续。

isreal(x)

返回一个布尔数组,如果输入元素是实数,则为 True。

isrealobj(x)

如果 x 不是复数类型或复数数组,则返回 True。

isscalar(element)

如果 *element* 的类型是标量类型,则返回 True。

逻辑运算#

logical_and(x1, x2, /[, out, where, ...])

逐元素计算 x1 AND x2 的真值。

logical_or(x1, x2, /[, out, where, casting, ...])

逐元素计算 x1 OR x2 的真值。

logical_not(x, /[, out, where, casting, ...])

逐元素计算 NOT x 的真值。

logical_xor(x1, x2, /[, out, where, ...])

逐元素计算 x1 XOR x2 的真值。

比较#

allclose(a, b[, rtol, atol, equal_nan])

如果两个数组在容差范围内逐元素相等,则返回 True。

isclose(a, b[, rtol, atol, equal_nan])

返回一个布尔数组,其中两个数组在容差范围内逐元素相等。

array_equal(a1, a2[, equal_nan])

如果两个数组具有相同的形状和元素,则返回 True,否则返回 False。

array_equiv(a1, a2)

如果输入数组形状一致且所有元素相等,则返回 True。

greater(x1, x2, /[, out, where, casting, ...])

逐元素返回 (x1 > x2) 的真值。

greater_equal(x1, x2, /[, out, where, ...])

逐元素返回 (x1 >= x2) 的真值。

less(x1, x2, /[, out, where, casting, ...])

逐元素返回 (x1 < x2) 的真值。

less_equal(x1, x2, /[, out, where, casting, ...])

逐元素返回 (x1 <= x2) 的真值。

equal(x1, x2, /[, out, where, casting, ...])

逐元素返回 (x1 == x2)。

not_equal(x1, x2, /[, out, where, casting, ...])

逐元素返回 (x1 != x2)。