【发布时间】:2022-09-24 16:33:45
【问题描述】:
我正在尝试将对象转换为 int,但它给了我一个 ValueError 错误:int() 以 10 为基数的无效文字:\'323.0\'
alltrips.dtypes
tripduration object
from_station_id object
from_station_name object
to_station_id object
to_station_name object
usertype object
gender object
birthyear int32
dtype: object
display (alltrips.tripduration)
0 323.0
1 377.0
2 2,904.0
3 747.0
4 183.0
...
642681 288.0
642682 514.0
642683 427.0
642684 200.0
642685 1,285.0
Name: tripduration, Length: 3040517, dtype: object
alltrips[\"tripduration\"] = alltrips[\"tripduration\"].astype(int)