code: def detrend(self, detrend='constant'):
          
          data = signal.detrend(self.value, type=detrend).view(type(self))
          data.__metadata_finalize__(self)
          data._unit = self.unit
          return data
docs: Remove the trend from this `TimeSeries`
  
          This method just wraps :func:`scipy.signal.detrend` to return
          an object of the same type as the input.
  
          Parameters
          ----------
          detrend : `str`, optional
              the type of detrending.
  
          Returns
          -------
          detrended : `TimeSeries`
              the detrended input series
  
          See Also
          --------
          scipy.signal.detrend
              for details on the options for the `detrend` argument, and
              how the operation is done