将DataFrame格式的数据中不是数字类型的去掉并重新索引:

首先将所有的值都转成整数字类型

df['io']=pd.to_numeric(df['io'],'coerce')
df['res']=pd.to_numeric(df['res'],'coerce')

coerce是将不能转为数字类型的都变成NaN,其他两个是ignore:忽略,也就是不转换,raise:报错 默认是raise 

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_numeric.html

然后将所有NaN都删除

df=df.dropna()

后面也有参数,可以选择按行删除还是列删除;有一个NaN就删除还是全都是NaN才删除

https://jingyan.baidu.com/article/ff4116250521ce12e4823795.html

重新索引:

df=df.reset_index(drop=True)

注意这里不能用reindex,而且后面要加上 drop=Ture,不然原来的index还是会保留着