📜  numpy 数组多数和多少 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:01.602000             🧑  作者: Mango

代码示例1
import numpy as np
  
  
x = np.array([1, 1, 1, 2, 3, 4, 2, 4, 3, 3, ])
print("Original array:")
print(x)
  
print("Most frequent value in above array")
y = np.bincount(x)
maximum = max(y)
  
for i in range(len(y)):
    if y[i] == maximum:
        print(i, end=" ")