title: Python : How to compare two data frames
body: <p>I have two data frames:</p>
  
  <pre><code>df1
  
  A1    B1
  1     a
  2     s
  3     d
  </code></pre>
  
  <p>and</p>
  
  <pre><code>df2
  
  A1    B1
  1     a
  2     x
  3     d
  </code></pre>
  
  <p>I want to compare df1 and df2 on column B1. The column A1 can be used to join. I want to know:</p>
  
  <ol>
  <li>Which rows are different in df1 and df2 with respect to column B1?</li>
  <li>If there is a mismatch in the values of column A1. For example whether df2 is missing some values that are there in df1 and vice versa. And if so, which ones?</li>
  </ol>
  
  <p>I tried using merge and join but that is not what I am looking for.</p>