np.bincount

# np.bincount就是一个统计数组值出现次数的函数
# bin的个数=最大值+1,每个元素依次为0->max出现的次数
>>> a = [1,1,2,3,4,5]
>>> np.bincount(a)
array([0, 2, 1, 1, 1, 1])

参考:

https://blog.csdn.net/xlinsist/article/details/51346523

猜你喜欢

转载自blog.csdn.net/Ahead_J/article/details/85113090
np