我尝试使用scipy.stats模式来查找最常见的值。但是,我的矩阵包含很多零,因此这始终是模式。
scipy.stats
例如,如果我的矩阵如下所示:
array = np.array([[0, 0, 3, 2, 0, 0], [5, 2, 1, 2, 6, 7], [0, 0, 2, 4, 0, 0]])
我想得到2退货的价值。
2
python scipy
python ×1
scipy ×1