python 统计array中nan的个数要怎么做

2025-04-07 23:13:35
推荐回答(1个)
回答1:

在help NaN的说明文档中有介绍关于NaN相等的问题:

Because two NaNs are not equal to each other, logical operations involving NaNs always return false, except ~= (not equal). Consequently,

NaN ~= NaN
ans =
1
NaN == NaN
ans =
0

因为任何两个NaN都是不相等的,因此涉及NaN的逻辑运算都会返回false,除了~=

Use the isnan function to detect NaNs in an array.

isnan([1 1 NaN NaN])
ans =
0 0 1 1

使用isnan来检测出数列中的NaN

object(对象)指的class(类)的实例化.老实说我没用过,一般的double型变量,char型变量都能被称之为class.

具体可以参考Matlab Class中的文档,我也迷迷糊糊,不知道lz你要有何用.