首页 > > > Python NumPy 逻辑函数

逻辑函数
真值测试
all(a[, axis, out, keepdims])测试是否沿给定轴的所有数组元素求值为True。
>>> np.all([[True,False],[True,True]])
False
>>>
>>> np.all([[True,False],[True,True]], axis=0)
array([ True, False])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])对正无穷大逐个元素进行测试,以布尔数组形式返回结果。

来源:开始自媒体
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4715/viewspace-3149539/ ,如需转载,请注明出处,否则将追究法律责任。