title: Comparing rows elements in python
body: <p>We have a list:</p>
  
  <pre><code>import numpy as np
  
  
  A=[(2, 2, 0), (1, 5, 0), (6, 8, 0), (2, 2, 2) ]
  
  ax=np.asarray([row[0] for row in A])
  ay=np.asarray([row[1] for row in A])
  az=np.asarray([row[2] for row in A])
  
  print (ax,ay,az)
  </code></pre>
  
  <p>I would like to compare  ax with ay and when i find equal pairs where ax==ay like (2, 2, 0) and (2, 2, 2) i keep the pair once but add the az values. So in our example the new wanted  list B would be:</p>
  
  <pre><code>B=[(2, 2, 2), (1, 5, 0), (6, 8, 0)]
  </code></pre>
  
  <p>It would be nice to have some code that would be efficient with really huge lists too.</p>