Lon_X Lat_Y
5,234234 6,3234234
5,234234 6,3234234
5,234234 6,3234234
5,234234 6,3234234
5,234234 6,3234234
我在上面的熊猫/数据框中有GPS坐标。然而,这些使用逗号分隔符。使用熊猫将这些转换为浮动GPS坐标的最佳方法是什么?替换数据帧中的值Python
for item in frame.Lon_X:
float(item.replace(",", ".")) # makes the conversion but does not store it back
我已经试过iteritems功能,但似乎很慢,给我一个警告,我真的不明白:
for index, value in frame.Lon_X.iteritems():
frame.Lon_X[index] = float(value.replace(",", "."))
见警告文档中: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy 从ipykernel进口kernelapp为app