0

When reading data from a .xlsx file using pandas.read_excel(), some values are changed (only their decimal part). Example: 927.2 is changed to 927.19999999999

About data: It has ~7000 rows and 7 columns. So I am not sure of the fraction of values getting changed.

I have checked the data type, and it shows numpy.float64.

What else I did: I tried changing the value of another cell to 927.2, and pandas read it as 927.2. I also changed the value of the cell for which the value is getting modified to 927.3, and it read as 927.3. But, when I changed the value back to 927.2 from 927.3, pandas read it correctly as 927.2.

Any ideas on how to solve this? I definitely cannot re-type all the values so as to correct them.

P.S. This question has been asked before, but it is marked duplicate. But, the duplicate question has solution for read_csv(), which is by using float_precision='round_trip'. And, float_precision='round_trip' is applicable to only read_csv(), not read_excel(). Link to the duplicate question: Pandas changes numbers when reading from Excel

  • [This](https://stackoverflow.com/a/57801832/11865956) seems like it might work. (Lower voted answer) – BeRT2me May 09 '22 at 05:21

0 Answers0