Python how does == work for float/double?
<p>I know using <code>==</code> for float is generally not safe. But does it work for the below scenario?</p>

<ol>
<li>Read from csv file A.csv, save first half of the data to csv file B.csv without doing anything.</li>
<li>Read from both A.csv and B.csv. Use <code>==</code> to check if data match everywhere in the first half.</li>
</ol>

<p>These are all done with Pandas. The columns in A.csv have types datetime, string, and float. Obviously <code>==</code> works for datetime and string, so if <code>==</code> works for float as well in this case, it saves a lot of work.</p>

<p>It seems to be working for all my tests, but can I assume it will work all the time?</p>

<p>The same string representation will become the same float representation when put through the same parse routine. The float inaccuracy issue occurs either when mathematical operations are performed on the values or when high-precision representations are used, but equality on low-precision values is no reason to worry.</p>

python pandas floating-point