文章目录
问题复现
import numpy as np
a = np.arange(10)
a[1] = np.nan
报错
ValueError: cannot convert float NaN to integer
解决方案
a.astype(float)
a[1] = np.nan
先把a转化成float类型的即可。
标签:convert,nan,float,NaN,报错,np,ValueError
来源: https://blog.csdn.net/shiyuzuxiaqianli/article/details/123147778