Pandas字符串作为字符串(对象)读入,但是以数字表示法

时间:2017-07-14 20:46:07

标签: python pandas format

我在csv文件中读到。

govselldata = pd.read_csv('govselldata.csv', dtype={'BUS_LOC_ID': str})
#or by this
#govselldata = pd.read_csv('govselldata.csv')

我有字符串格式的值。

govselldata.dtypes
a                     int64
BUS_LOC_ID            object

但他们不像这个'255048925478501030',而是像这样科学的2.55048925478501e + 17。

如何将其转换为'255048925478501030'?

编辑:使用float()不起作用。这可能是由于一些空白区域。

govselldata['BUS_LOC'] = govselldata['BUS_LOC_ID'].map(lambda x: float(x)) 
ValueError: could not convert string to float:

0 个答案:

没有答案