Find common elements between two arrays using NumPy

In this python numpy program, we will find common elements between 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 common elements between two arrays using np.intersect1d().
  4. Print the output
				
					import numpy as np
x = np.array([56,18,28,36])
y = np.array([76,36,56])

print(np.intersect1d(x,y))
				
			

Output :

				
					[36 56]
				
			

find the real and imaginary parts of an array of complex numbers.

get the unique elements of an array.

Leave a Comment