I'm trying to read a csv with pandas using the read_csv command. However, one of my columns is a 15 digit number which is read in as a float and then truncated to exponential notation. So the entries in this column become 2.09228E+14 instead of the 15 digit number I want. I've tried reading it as a string, but I get '2.09228E+14' instead of the number. Any suggestions?
Asked
Active
Viewed 1,922 times
0
-
I think it would be easier to just format the cells to not display in scientific notation - if they are coming from an excel document first – woodlumhoodlum Feb 24 '14 at 23:17
-
This is a duplicate. See http://stackoverflow.com/questions/17737300/suppressing-scientific-notation-in-pandas – Henry David Thorough Feb 24 '14 at 23:33
-
This is just a display issue, the data is still a float, to change the float precision use `pandas.set_option('display.precision', 15)` – EdChum Feb 25 '14 at 09:20
1 Answers
1
Just do
str(int(float('2.09228E+14')))
which should give you '209228000000000'

Yanshuai Cao
- 1,257
- 10
- 14