We have a list:
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)
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:
B=[(2, 2, 2), (1, 5, 0), (6, 8, 0)]
It would be nice to have some code that would be efficient with really huge lists too.