0

I read in a csv file.

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

I have values in string format.

govselldata.dtypes
a                     int64
BUS_LOC_ID            object

But they are not like this '255048925478501030', but rather scientific like this 2.55048925478501e+17.

How do i convert it to '255048925478501030'?

Edit: Using float() did not work. This could be due to some white space.

govselldata['BUS_LOC'] = govselldata['BUS_LOC_ID'].map(lambda x: float(x)) 
ValueError: could not convert string to float:
user1569341
  • 333
  • 1
  • 6
  • 17
  • same question as https://stackoverflow.com/questions/28321336/converting-a-number-in-exponential-form-to-decimal-form-in-python – Volgar Jul 14 '17 at 20:51
  • 2
    Possible duplicate of [Converting a number in exponential form to decimal form in python](https://stackoverflow.com/questions/28321336/converting-a-number-in-exponential-form-to-decimal-form-in-python) – Scott Boston Jul 14 '17 at 20:52
  • Using float() did not work. govselldata['BUS_LOC'] = govselldata['BUS_LOC_ID'].map(lambda x: float(x)) ValueError: could not convert string to float: – user1569341 Jul 14 '17 at 21:11
  • Sounds like not BUS_LOC_ID is not all numbers. Are there, Nans? – Geoff D Jul 14 '17 at 21:42

0 Answers0