numpy.
setxor1d
Find the set exclusive-or of two arrays.
Return the sorted, unique values that are in only one (not both) of the input arrays.
Input arrays.
If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False.
Sorted 1D array of unique values that are in only one of the input arrays.
Examples
>>> a = np.array([1, 2, 3, 2, 4]) >>> b = np.array([2, 3, 5, 7, 5]) >>> np.setxor1d(a,b) array([1, 4, 5, 7])