I have a mock-up dataframe below and resembles very closely to my original dataframe
sof = pd.DataFrame({'id':['1580326032400705442181105','15803260000063243713608360','1580326343500677412104013','15803260343000000705432103406'],'class':['a','c','c','d']})
When i write this dataframe to destop using the 'to_csv' function, i see the ids automatically being converted to the scientific format.(example : 1.5803260324007E+24) I have a few questions on this
- why does python convert this column (obviously of type 'obj') to a numberic format?
- How do i preserve my format?
I have tried the following
sof.to_csv('path',float_format='%f',index = False)
Doesnt seem to change anything
sof['id'].astype(int).astype(str)
Trying to convert the supposed "float" to int and then to string
It gives the following error : OverflowError: Python int too large to convert to C long
Can i get some guidance on how this can be achieved?