np.unique([1, 3, 0, 3, 1, 1], return_counts=True)
returns
(array([0, 1, 3]), array([1, 3, 2]))
which excludes missing elements, in this case, 2.
Is there an easy and efficient way to get all counts, for example:
count(ar=[1, 3, 0, 3, 1, 1], from=0, to=4) # returns [1, 3, 0, 2]
?