Python Program to Find Unique Items in an Array

Write Python Program to Find and Print the Unique Items in an Array. The unique function in the Numpy module returns the unique array of items. And this example uses that function to return a distinct array of items.

import numpy as np

orarr = np.array([10, 20, 10, 30, 40, 30, 70, 11, 19, 40])
print("Original Array      = ", orarr)

uniquearr = np.unique(orarr)
print("Unique Array Items  = ", uniquearr)
Python Program to Find Unique Items in an Array 1

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.