numpy.setdiff1d
- 
numpy.setdiff1d(ar1, ar2, assume_unique=False)[source]
- 
Find the set difference of two arrays. Return the unique values in ar1that are not inar2.Parameters: - 
ar1 : array_like
- 
Input array. 
- 
ar2 : array_like
- 
Input comparison array. 
- 
assume_unique : bool
- 
If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False. 
 Returns: - 
setdiff1d : ndarray
- 
1D array of values in ar1that are not inar2. The result is sorted whenassume_unique=False, but otherwise only sorted if the input is sorted.
 See also - 
numpy.lib.arraysetops
- Module with a number of other functions for performing set operations on arrays.
 Examples>>> a = np.array([1, 2, 3, 2, 4, 1]) >>> b = np.array([3, 4, 5, 6]) >>> np.setdiff1d(a, b) array([1, 2]) 
- 
    © 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
    https://docs.scipy.org/doc/numpy-1.16.1/reference/generated/numpy.setdiff1d.html