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