scipy.stats.mstats.mode

scipy.stats.mstats.mode(a, axis=0)[源代码]

返回传递的数组中的模态(最常见)值的数组。

参数
aarray_like

要查找其模式的N维数组。

axis整型或无型,可选

要沿其运行的轴。默认值为0。如果没有,则对整个阵列进行计算 a

退货
modendarray

模式值的数组。

countndarray

每种模式的计数数组。

注意事项

有关更多详细信息,请参阅 stats.mode

示例

>>> from scipy import stats
>>> from scipy.stats import mstats
>>> m_arr = np.ma.array([1, 1, 0, 0, 0, 0], mask=[0, 0, 1, 1, 1, 0])
>>> stats.mode(m_arr)
ModeResult(mode=array([0]), count=array([4]))
>>> mstats.mode(m_arr)
ModeResult(mode=array([1.]), count=array([2.]))