scipy.stats.mstats.tmean#

scipy.stats.mstats.tmean(a, limits=None, inclusive=(True, True), axis=None)[source]#

Compute the trimmed mean.

Parameters
aarray_like

Array of values.

limitsNone or (lower limit, upper limit), optional

Values in the input array less than the lower limit or greater than the upper limit will be ignored. When limits is None (default), then all values are used. Either of the limit values in the tuple can also be None representing a half-open interval.

inclusive(bool, bool), optional

A tuple consisting of the (lower flag, upper flag). These flags determine whether values exactly equal to the lower or upper limits are included. The default value is (True, True).

axisint or None, optional

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

Returns
tmeanfloat

Notes

For more details on tmean, see stats.tmean.

Examples

>>> from scipy.stats import mstats
>>> a = np.array([[6, 8, 3, 0],
...               [3, 9, 1, 2],
...               [8, 7, 8, 2],
...               [5, 6, 0, 2],
...               [4, 5, 5, 2]])
...
...
>>> mstats.tmean(a, (2,5))
3.3
>>> mstats.tmean(a, (2,5), axis=0)
masked_array(data=[4.0, 5.0, 4.0, 2.0],
             mask=[False, False, False, False],
       fill_value=1e+20)