computer_knowledge

about NaN

2016-11-08  本文已影响0人  veronachiu

NaN是什么

NaN是空值,在Python中表示什么也没有。在R中表示为NULL;

如何产生NaN

通过np.nan()函数产生NaN值;

NaN的type为float,可以和其他类型的数据组成一个list。

NaN的特性

判断是否为NaN很简单:

np.nan()==np.nan():False #通过此方法可以简单判断是不是NaN

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

以上错误常见于np.isnan()函数运用于非float数值上,会报以上错误。

上一篇 下一篇

猜你喜欢

热点阅读