python使用Counter實現二維數組按列(行)統計元素出現個數

主要是用到了 collections 裏面的Counter函數python import numpy as np from collections import Counter rows=10 cols=9 arr=np.random.random_integers(1,10,(10,9))#生成整數數組 print("二維數組元素:",arr) result = [Counter(arr[:,
相關文章
相關標籤/搜索