Question(s):
How to remove items from an array that are existing in another array in Python Numpy?
Sample Answer:
We can use the Numpy method setdiff1d() to remove items from one array that are existing in another array.
Following is an example code:
ar1 = np.array([9,8,5,6,4,3,1]) ar2 = np.array([6,3,7,0,1]) newAr = np.setdiff1d(ar1,ar2) Output: array([9,8,5,4,0])