float('nan')是Nan不是一个数字,我该如何判断一个值为nan,有什么简单的方法么?

使用math.isnan()来进行判断

>>> import math
>>> x=float('nan')
>>> math.isnan(x)
True
>>> 

来源: https://stackoverflow.com/questions/944700/how-can-i-check-for-nan-values

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-07-15
  • 2021-07-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2021-12-07
  • 2021-12-07
  • 2022-12-23
相关资源
相似解决方案