2019-04-22
阅读量:
534
如何找到数组中最频繁的值
# 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.0000
0
5
关注作者
收藏
评论(0)
发表评论
暂无数据

