I haven't been able to replicate this with a minimal example, but maybe I can try to explain it. I have a function like this:
import pandas as pd
def myfile():
A = pd.read_csv('myfile.csv')
[some processing]
A.to_csv('myfile2.csv')
return A
Now the problem is that if I do
t1 = myfile()
t2 = pd.read_csv('myfile2.csv')
they end up returning different results! I saved both t1
and t2
and did a diff
on them, only to find that they different in the floating points, like this
2c2
< A,-61.54871999999999,-30.01167
---
> A,-61.54871999999997,-30.01167
5c5
Unfortunately, the saved version gives me the "correct" results. Why would the return values and the read_csv
differ?
[There are similar question, but not exactly this: see here, for example]