首页 > 编程知识 正文

python没有numpy库,lambda python

时间:2023-05-06 19:08:25 阅读:135631 作者:4805

概述:

numpy.isNaN(array[,out] ) :测试每个元素是否为nan,并以布尔数组形式返回结果。

array : [ array _ like ] inputarrayorobjectwhoseelements,we need to test for infinity

out :[ndarray,optional ] outputarrayplacedwithresult。

itstypeispreservedanditmustbeoftherightshapetoholdtheoutput。

返回:

booleanarraycontainingtheresult.forscalarinput,theresultisanewbooleanwithvalue

trueiftheinputispositiveornegativeinfinity; otherwise the value is False。

For array input,theresultisabooleanarraywiththesameshapeastheinputandthevalues

aretruewherethecorrespondingelementoftheinputispositiveornegativeinfinity;

elsewhere the values are False。

# python程序设计

# numpy.isnan () method

导入编号为geek

print(ISnan: )、geek.Isnan(1)、(n ) )

print(ISnan: )、geek.Isnan(0)、(n ) )

# not a number

print(ISNan: )、geek.Isnan )和“n”

# infinity

print(ISnan: )、geek.isnan (geek.INF )、(n ) ) ) ) ) ) ) ) ) ) 652

print(ISnan: )、geek.isnan (geek.ninf )和“n”

x=geek.Array([-geek.INF,0 .geek.inf] ) )。

y=geek.array ([ 2,2,2 ] ) )。

print('checkingforNan: ',geek.isnan(x () x,y ) ) ) ) ) ) ) ) ) )。

输出:

is nan :假

is nan :假

Is NaN: True

is nan :假

is nan :假

Checking for NaN: [0 0 0]

# python程序设计

# numpy.isnan () method

导入编号为geek

# returns true/falsevalueforeachelement

b=geek.arange(20 ).reshape (5,4 ) ) ) ) ) ) ) )。

print((n ),b ) ) ) ) ) ) ) ) ) ) ) ) ) ) )。

print((NISNan ) notanumber ) :(n ),geek.isnan(b ) ) ) ) ) ) ) ) 65

b=[[1j],

print((NISNan ) notanumber ) :(n ),geek.isnan(b ) ) ) ) ) ) ) ) 65

输出:

ISnan(notanumber ) :

ISnan(notanumber ) :

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。