title: Check equality of float columns in python
body: <p>I have a dataframe with 2 columns containing floats. I first excluded rows where columns contain zeros and then wanted to check for each row, if the elements of the columns are equal.</p>
  
  <p>I tried:</p>
  
  <pre><code>df.loc[(df['col1'] != 0.0) &amp; (df['col2'] != 0.0), 'Error'] = np.where(assert_almost_equal(df['col1'], df['col2']), 'Not equal', '')
  </code></pre>
  
  <p>result was:</p>
  
  <pre><code>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  
  <p>and also tried:</p>
  
  <pre><code>np.where(df['col1'] == df['col2'], 'Not equal', '')
  </code></pre>
  
  <p>and</p>
  
  <pre><code>np.where(df.col1.eq(df.col2), 'Not equal', '')
  </code></pre>
  
  <p>and result was:</p>
  
  <pre><code>ValueError: shape mismatch: value array of shape (24788,) could not be broadcast to indexing result of shape (9576,)
  </code></pre>
  
  <p>and also tried <code>apply</code>-function.</p>
  
  <p>How can I compare the floats within two columns row by row? I do really want need equality, not <code>isclose</code> or something similar.</p>
  
  <p>Thank you,</p>
  
  <p>MaMo</p>