Numpy

Numpy (12)

Jun's N 2022. 8. 2. 23:15

How to remove from one array those items that exist in another?

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

np.setdiff1d(a,b)

# output
array([1, 2, 3, 4])

 

728x90