• Lesson18——NumPy 逻辑函数


    NumPy 教程目录 

    真值测试

    方法描述
    all(a[, axis, out, keepdims]) 测试是否沿给定轴的所有数组元素求值为True。
    any(a[, axis, out, keepdims]) 测试沿给定轴的任何数组元素的求值是否为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(num) 如果num的类型是标量类型,则返回True。

    逻辑运算

    方法描述
    logical_and(x1, x2, /[, out, where, …]) 按元素计算x1和x2的真值。
    logical_or(x1, x2, /[, out, where, casting, …]) 按元素计算x1或x2的真值。
    logical_not(x, /[, out, where, casting, …]) 计算非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) 如果两个数组具有相同的形状和元素,则为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)。

     

     

     

    Lesson18——NumPy 逻辑函数

  • 相关阅读:
    Hrbust-1492 盒子(二分图最大匹配)
    数据结构——二叉树的建立和遍历(递归建树&层序遍历建树)
    HDU 1710 二叉树遍历
    HDU 2891
    HDU 2895 贪心 还是 大水题
    POJ 2896 另解暴力
    POJ 2896 AC自动机 or 暴力
    HDU 1714 math
    POJ 1328 贪心
    POJ 2109 巧妙解法
  • 原文地址:https://www.cnblogs.com/BlairGrowing/p/15922464.html
Copyright © 2020-2023  润新知