On 8/9/2012 4:06 PM, giuseppe.amatu...@gmail.com wrote:
Terry and MRAB, thanks for yours suggestions, in the end i found this solutionmask=( a != 0 ) & ( b != 0 ) a_mask=a[mask] b_mask=b[mask] array2D = np.array(zip(a_mask,b_mask)) unique=dict() for row in array2D : row = tuple(row) if row in unique: unique[row] += 1 else: unique[row] = 1
I believe the 4 lines above are equivalent to unique[row] = unique.get(row, 0) + 1 -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list