Numpy

Numpy (13)

Jun's N 2022. 8. 3. 20:35

How to get the positions where elements of two arrays match?

a = np.array([1,2,3,2,3,4,3,4,5,6])
b = np.array([7,2,10,2,7,4,9,4,9,8])

np.where(a == b)

# output
(array([1, 3, 5, 7]),)
728x90