I have two arrays, and I have found how to identify the mutually exclusive elements with np.setxor1d(a,b)
. For example:
a = np.random.randint(11, size=10) #first array
b = np.random.randint(11, size=10) #second array
ex = np.setxor1d(a,b) #mutually exclusive array
a
Out[1]: [1, 5, 3, 7, 6, 0, 10, 10, 0, 9]
b
Out[2]: [1, 9, 8, 6, 3, 5, 8, 0, 3, 10]
ex
Out[3]: [7, 8]
Now, I am trying to figure out how to get the indices of the elements of the exclusive array, ex
for both a
and b
. In a way such as a_mutex_ind
and b_mutex_ind
. Does anyone know of a clever way to do this WITHOUT a for loop?
Thanks!