convert data to numeric element wise , python,pandas

In [11]: df
Out[11]: 
   x  y
0  a  1
1  b  2

In [12]: df.dtypes
Out[12]: 
x    object
y    object
dtype: object

In [13]: df.convert_objects(convert_numeric=True)
Out[13]: 
   x  y
0  a  1
1  b  2

In [14]: df.convert_objects(convert_numeric=True).dtypes
Out[14]: 
x    object
y     int64
dtype: object



http://stackoverflow.com/questions/21197774/assign-pandas-dataframe-column-dtypes
原文地址:https://www.cnblogs.com/ppqchina/p/6517625.html