scipy.stats.trim1#

scipy.stats.trim1(a, proportiontocut, tail='right', axis=0)[source]#

Slice off a proportion from ONE end of the passed array distribution.

If proportiontocut = 0.1, slices off ‘leftmost’ or ‘rightmost’ 10% of scores. The lowest or highest values are trimmed (depending on the tail). Slice off less if proportion results in a non-integer slice index (i.e. conservatively slices off proportiontocut ).

Parameters
aarray_like

Input array.

proportiontocutfloat

Fraction to cut off of ‘left’ or ‘right’ of distribution.

tail{‘left’, ‘right’}, optional

Defaults to ‘right’.

axisint or None, optional

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

Returns
trim1ndarray

Trimmed version of array a. The order of the trimmed content is undefined.

Examples

>>> from scipy import stats
>>> a = np.arange(20)
>>> b = stats.trim1(a, 0.5, 'left')
>>> b
array([10, 11, 12, 13, 14, 16, 15, 17, 18, 19])