scipy.stats.mstats.
mode#
- scipy.stats.mstats.mode(a, axis=0)[原始碼]#
傳回已傳遞陣列中模態(最常見)值的陣列。
- 參數:
- aarray_like
要尋找模態的 n 維陣列。
- axisint 或 None,選用
要沿其運算的軸。預設值為 0。如果為 None,則在整個陣列 a 上計算。
- 傳回值:
- modendarray
模態值的陣列。
- countndarray
每個模態的計數陣列。
註解
有關更多詳細資訊,請參閱
scipy.stats.mode
。範例
>>> import numpy as np >>> 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]) >>> mstats.mode(m_arr) # note that most zeros are masked ModeResult(mode=array([1.]), count=array([2.]))