In this python numpy program, we will find the union of two arrays using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create two arrays using np.array().
- Find the union of two arrays using np.union1d().
- Print the output
import numpy as np
x = np.array([56,18,28,36])
y = np.array([76,36,56,90])
print(np.union1d(x,y))
Output :
[18 28 36 56 76 90]