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 items. This Python example uses the unique function and returns the distinct array 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