报错语句

data['col'] = data['col'].apply(int)

 

报错提示

ValueError: cannot convert float NaN to integer

 

报错原因

因为字段中存在NaN值,所以无法转换为指定类型

 

解决办法

剔除该字段中的NaN值所在的行

 

具体可参考(需要科学上网):https://stackoverflow.com/questions/47333227/pandas-valueerror-cannot-convert-float-nan-to-integer

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐