Return the number of occurrences of each value in x.
x must be a list of non-negative integers. The output, b[i], represents the number of times that i is found in x. If weights is specified, every occurrence of i at a position p contributes weights[p] instead of 1.
See also: histogram, digitize, unique.