在熊猫上将dtype'object'转换为int

时间:2020-03-23 05:56:48

标签: python pandas csv

我尝试了多种方法来转换数据框上的列之一。但是什么都没用。

  1. 第一次尝试

    false 它向我显示错误:“ ValueError:以10为底的int()的无效文字:'favorite_count'”

  2. 第二次尝试

    df['favorite_count'].astype(str).astype(int)

它向我显示错误:ValueError:无法将非有限值(NA或inf)转换为整数

我使用tweet api从twitter下载了数据,并保存在csv文件中。

请帮助我解决问题。谢谢

0 个答案:

没有答案