在numpy / scipy,中,有没有一种高效的方法来获取数组中唯一值的频率计数?
numpy
scipy
大致是这样的:
x = array( [1,1,1,2,2,2,5,25,1,1] ) y = freq_count( x ) print y >> [[1, 5], [2,3], [5,1], [25,1]]
(对于R用户来说,我基本上是在寻找table()函数)
table()
https://stackoverflow.com/questions/10741346
相似问题