Find the union of two arrays using NumPy

In this python numpy program, we will find the union of two arrays using NumPy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create two arrays using np.array().
  3. Find the union of two arrays using np.union1d().
  4. 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]
				
			

find the set difference between two arrays.

find the indices of the maximum value of an array.

Leave a Comment