arr = np.array([[1,2,100,4,5,6],[1,1,100,3,5,5],[2,2,4,4,6,6]])
方法一:
count = np.bincount(arr[:,2]) # 找出第3列最頻繁出現的值 value = np.argmax(count)
方法二:
from collections import Counter value = Counter(arr[:,2]).most_common()
arr = np.array([[1,2,100,4,5,6],[1,1,100,3,5,5],[2,2,4,4,6,6]])
方法一:
count = np.bincount(arr[:,2]) # 找出第3列最頻繁出現的值 value = np.argmax(count)
方法二:
from collections import Counter value = Counter(arr[:,2]).most_common()