Improve Performance of Comparing two Numpy Arrays
This can be implemented concisely by using numpy.add.at:

In [2]: c = np.zeros((3, 3), dtype=int)                                         

In [3]: np.add.at(c, (x, y), 1)                                                 

In [4]: c                                                                       
Out[4]: 
array([[16, 10,  0],
       [ 2, 10,  0],
       [ 2,  0, 22]])