code: def trimboth(a, proportiontocut, axis=0):
      """
      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 data to trim at each end.
      axis : int or None
          Axis along which the observations are trimmed. The default is to trim
          along axis=0. If axis is None then the array will be flattened before
          trimming.
  
      Returns
      -------
      out : array-like
          Trimmed version of array `a`.
  
      Examples
      --------
      >>> from scipy import stats
      >>> a = np.arange(20)
      >>> b = stats.trimboth(a, 0.1)
      >>> b.shape
      (16,)
  
      """
      a = np.asarray(a)
      if axis is None:
          a = a.ravel()
          axis = 0
      nobs = a.shape[axis]
      lowercut = int(proportiontocut * nobs)
      uppercut = nobs - lowercut
      if lowercut >= uppercut:
          raise ValueError("Proportion too big.")
  
      sl = [slice(None)] * a.ndim
      sl[axis] = slice(lowercut, uppercut)
      return a[tuple(sl)]
  
file_path: statsmodels/statsmodels/stats/robust_compare.py
imports: import numbers
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: trimboth(a, proportiontocut, axis) and returns: a