import itertools
array = [[0, 1], [1, 0], [1, 2], [2, 3], [2, 1]]
d = {k: [i[1] for i in v] for k, v in itertools.groupby(sorted(array), lambda
    x: x[0])}
Create dictionary of value frequencies from numpy array