unique() (NumPy)

np.unique() returns the sorted, distinct values of an array with duplicates removed. With return_counts=True it also tells you how many times each distinct…