Find and count unique elements in array

Find unique element in array

import numpy as np
v = [1,0,  1, 2, 1, 1, 1, 2, 0, 0, 2]
np.unique(v)
array([0, 1, 2])

Count how many occurences

np.bincount(v)
array([3, 5, 3])