Latitude Longitude coordinates are being padded with extra digits in python float

224 views Asked by At

I have data in csv file that I am reading using pandas. There are latitude, longitude coordinates, some have higher precision than others. for ex, -117.8982898932 or -100.3456. The ones that have a lower precision, python is padding it with 0000001 so it becomes -100.34560000001. I want to pad the lower precision number with zeroes. But how do I know how many zeroes to add as each number has different precision?

This is important because once I read in the data (which is terabytes, there are numbers, strings, datetime, latitude, longitude, etc), I am doing preprocessing and then I want to make sure I have read in the correct data so I am comparing with the original csv file.

So if original file has -100.3456 and python stores is as -100.34560000001, and when I compare, its a problem. I have not checked all numbers but it will be a problem if its padding with digits other than zero.

0

There are 0 answers