Skip to content
Advertisement

pd.read_csv() keep number of decimals

I want to read a csv but it culls the number of decimals:

JavaScript

gives (first 2 rows, first five columns):

enter image description here

the original data (here) has 8 decimal places in the 3rd and 4th columns. I need those.

2211 196568.000 -25.732036008 28.282629130 1387.8994
2211 196569.000 -25.732032386 28.282633712 1389.4025

How do I read a csv and retain the precision of the original data?

Advertisement

Answer

How do I read a csv and retain the precision of the original data?

You do have it, pandas simply limit number of digits for presentation purposes, consider following example

JavaScript

gives output

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement