2019-04-22
阅读量:
465
如何找到数组中最频繁的值
# np.bincount()
# Count number of occurrences of each value in array of non-negative ints.
Z = np.random.randint(0,5,10)
print Z
print np.bincount(Z)
print np.bincount(Z).argmax()
[1 0 4 1 1 2 0 1 2 3]
[2 4 2 1 1]
1






评论(0)


暂无数据