Curriculum
Course: NumPy
Login

Curriculum

NumPy

Text lesson

Finding Union

To retrieve the unique values from two arrays, use the union1d() method.

Example

Calculate the union of the following two set arrays.

import numpy as np

arr1 = np.array([1234])
arr2 = np.array([3456])

newarr = np.union1d(arr1, arr2)

print(newarr)