Compute the intersection of 2 numpy arrays

In this article we will use sets to compute the intersection of 2 numpy arrays

import numpy as np

array2a = np.array([[1, 2], [3, 3], [2, 1], [1, 3], [2, 1]])
array2b = np.array([[2, 1], [1, 4], [3, 3]])


a = set((tuple(i) for i in array2a))
b = set((tuple(i) for i in array2b))

a.intersection(b) # {(2, 1), (3, 3)}
{(2, 1), (3, 3)}