I'm writing a unit-test that should compare a saved CSV known results with processed results. My test failed although the result data were equal. My guess was that Panndas rounds the value in some way, so I've created the following snippet to test my speculation:
import pandas as pd
df = pd.DataFrame({'val':[-0.41676538151302184]})
df.to_csv('tmp.csv',index=False)
# Load the saved CSV and compare it
df2 = pd.read_csv('./tmp.csv')
df2.val.compare(df.val)
self other
0 -0.416765 -0.416765
Pandas shows the differences, although values appear to be equal. If I round the values, comparison successes.
What would be the right way to compare saved data to the calculated one?