### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Statistical functions (`scipy.stats`) »

# scipy.stats.trimboth

`scipy.stats.``trimboth`(a, proportiontocut)

  Slices off a proportion of items from both ends of an array.

  Slices off the passed proportion of items from both ends of the passed array (i.e., with proportiontocut = 0.1, slices leftmost 10% and rightmost 10% of scores). You must pre-sort the array if you want ‘proper’ trimming. Slices off less if proportion results in a non-integer slice index (i.e., conservatively slices off proportiontocut).

  Parameters : | a : array_like Data to trim. proportiontocut : float or int Proportion of total data set to trim of each end.
  Returns : | out : ndarray Trimmed version of array a.

  Examples

      >>> from scipy import stats
      >>> a = np.arange(20)
      >>> b = stats.trimboth(a, 0.1)
      >>> b.shape
      (16,)

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Statistical functions (`scipy.stats`) »