To retrieve the unique values from two arrays, use the union1d() method.
Calculate the union of the following two set arrays.
import numpy as np arr1 = np.array([1, 2, 3, 4]) arr2 = np.array([3, 4, 5, 6]) newarr = np.union1d(arr1, arr2) print(newarr) |