python DataFrame comparison using == operator
<p>I have two python dataframes of same structure and same number of rows
when I perform '==' operation on them they gives wrong answers</p>

<p>df1:</p>

<pre><code>      0     61561899
      1     56598947
      2     52231204
      3     10069030
      4     19900179
      5     52892001
      6     50015534
      7     10071207
      8     55455545
      9     10075649
      10    52050196
 Name: spn, dtype: object
</code></pre>

<p>df2:</p>

<pre><code>  0     61561899
  1     56598947
  2     52231204
  3     10069030
  4     19900179
  5     52892001
  6     50015534
  7     10071207
  8     55455545
  9     10075649
  10    52050196
  Name: spn, dtype: object
</code></pre>

<p>print df1 == df2<br>
the above python statement gives following output:</p>

<pre><code>  0     False
  1     False
  2     False
  3     False
  4     False
  5     False
  6     False
  7     False
  8     False
  9     False
  10    False
  Name: spn, dtype: bool
</code></pre>

<p>I dont know what am I missing. I am expecting all true.</p>

<p>Try cast to <code>str</code> and then compare:</p>

<pre><code>df1.spn.astype(str) == df2.spn.astype(str)
</code></pre>

<p>Or maybe need compare columns only:</p>

<pre><code>df1.spn == df2.spn
</code></pre>

python dataframe comparison