title: Dropping duplicates with custom logic
body: <p>I have a pandas dataframe with the following structure:</p>
  
  <pre><code>df:
  x      y      z1       z2        z3
  1.01  2.01   11.415   12.345    100
  1.009 2.009  11.415   12.345    100
  1.01  2.05   11.415   12.345    100
  </code></pre>
  
  <p>The columns x, and y are measured with some noise. My job is to "de-duplicate" the dataframe w.r.t columns z1, z2, z3 such that entries in columns x and y are not "far" from each other. In the above contrived example the first two rows (rows 1 and 2) are duplicates with the same entry in z columns and x and y reasonably "close". Note that row 3, the final row, also has the same entries but has a y value "far" away from other two rows (2.05 vs 2.01). I have logic to determine what counts as "far" and "close" for columns x and y. </p>
  
  <p>I am looking for a clean way to do this. I have tried windowed applications and using group by etc. but nothing seems to work nicely. Thanks.</p>