scipy.stats.mstats.

trimboth#

scipy.stats.mstats.trimboth(data, proportiontocut=0.2, inclusive=(True, True), axis=None)[source]#

Trims the smallest and largest data values.

Trims the data by masking the int(proportiontocut * n) smallest and int(proportiontocut * n) largest values of data along the given axis, where n is the number of unmasked values before trimming.

Deprecated since version 2.0.0: scipy.stats.mstats.trimboth is deprecated as of SciPy 2.0.0 and will be removed, along with the scipy.stats.mstats namespace, in SciPy 2.4.0. For similar functionality, use scipy.stats.trimboth with regular NumPy array(s), replacing masked values with NaNs and using the nan_policy=’omit’ option. See the Trimming and winsorization transition guide for alternatives.

Parameters:
datandarray

Data to trim.

proportiontocutfloat, optional

Percentage of trimming (as a float between 0 and 1). If n is the number of unmasked values before trimming, the number of values after trimming is (1 - 2*proportiontocut) * n. Default is 0.2.

inclusive{(bool, bool) tuple}, optional

Tuple indicating whether the number of data being masked on each side should be rounded (True) or truncated (False).

axisint, optional

Axis along which to perform the trimming. If None, the input array is first flattened.