我想從字符串轉換數據幀字段以在Pandas中浮動。熊貓:astype錯誤字符串以浮動(無法將字符串轉換爲浮點數:'7,50')
這是場:
In:
print(merged['platnosc_total'].head(100))
Out:
0 0,00
1 4,50
2 0,00
3 0,00
4 0,00
5 4,50
6 6,10
7 7,99
8 4,00
9 7,69
10 7,50
注7,50,最後一排,這似乎導致錯誤:
In:
merged['platnosc_total'].astype(float)
Out:
ValueError: could not convert string to float: '7,50'
這是否意味着其餘得到了轉化,只有7,50行是原因?
我怎樣才能真正把這個領域/專欄浮動?
([用逗號入浴液改變熊貓字符串列]的可能的複製https://stackoverflow.com/questions/34462207/change-pandas-string-column-with-逗號變成浮動) – FLab