DataFrame的数据类型转换

1 dfxxx['username']=pd.to_numeric(dfxxx['username'],errors='coerce')#将不能转换数据类型的值强制转换成NaN
2 dfxxx['username']=pd.Series(dfxxx['username']//1,index=dfxxx.index,dtype=int)#当遇到.0情况可以用这种形式转换成int类型

 更多数据类型转换

https://vimsky.com/article/3694.html

posted on 2018-01-19 11:14  hailuo  阅读(6253)  评论(0编辑  收藏  举报