0

Through pandas library, I'm trying to read CSV file, there is a column having scientific notation values. I'm trying to convert those 7.87899E+11 values into an integer using the below code but it gives output values like 787899000000000 and in CSV the actual value is 787898987690, I need the same o/p value.

Here is the code:

import pandas as pd
df = pd.read_csv('FilePath\\Vaccination_Data.csv')
pd.set_option('display.max_columns', None)
pd.set_option('display.float_format', lambda x: '%.2f' % x)
print(df)
Joe Ferndz
  • 8,417
  • 2
  • 13
  • 33
  • 2
    Does this answer your question? [Pandas - read\_csv scientific notation large number](https://stackoverflow.com/questions/58067051/pandas-read-csv-scientific-notation-large-number) – Razmik Melikbekyan Feb 25 '21 at 08:49
  • Hmm, first you say the CSV file contains a column with scientific notation number like `7.87899E+11`, next you say that the actual value in the CSV is 787898987690... I am sorry but I cannot understand. Could you show an extract of your CSV **as text** with the actual delimiters? – Serge Ballesta Feb 25 '21 at 09:26
  • Serge Ballesta, When we store a big number (787898987690) in excel/CSV file, it automatically gets converted into this format 7.87899E+11 but when we read the same file through pandas it shows 7.87899E+11 or 787899000000, I want this 787898987690 in output. – Riddhi Rana Feb 26 '21 at 11:40

1 Answers1

0

This worked for me. pd.set_option('display.float_format', lambda x: '%.3f' % x)