SciPy

scipy.stats.mstats.mode

scipy.stats.mstats.mode(a, axis=0)[source]

Returns an array of the modal (most common) value in the passed array.

Parameters:
a : array_like

n-dimensional array of which to find mode(s).

axis : int or None, optional

Axis along which to operate. Default is 0. If None, compute over the whole array a.

Returns:
mode : ndarray

Array of modal values.

count : ndarray

Array of counts for each mode.

Notes

For more details, see stats.mode.

Examples

>>> 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.]))

Previous topic

scipy.stats.mstats.kurtosis

Next topic

scipy.stats.mstats.mquantiles