Kaizar
Kaizar

Reputation: 1

pandas to csv without converting object to scientific notation

df['Acolumn']='85236E106'

When i df.to_csv('file') it outputs as '8.523600000000001e+110'

how can i convert to csv and leave the value as '85236E106' ?

I tried:

Upvotes: -1

Views: 256

Answers (1)

Kaizar
Kaizar

Reputation: 1

I just ran the file again and i'm not sure why df['Acolumn']='85236E106' is now not being converted to scientific notation. I'm using to_csv with only index=False as parameters. However I've added dtype={'Acolumn': pd.StringDtype()} to pd.read_sql_query just incase.

Upvotes: 0

Related Questions