code: def winsorize(x, axis=0, limits=0.01):
      
      # operate on copy
      x = x.copy()
  
      if isinstance(x, pd.DataFrame):
          return x.apply(_winsorize_wrapper, axis=axis, args=(limits, ))
      else:
          return pd.Series(_winsorize_wrapper(x, limits).values,
                           index=x.index)
docs: `Winsorize <https://en.wikipedia.org/wiki/Winsorizing>`_ values based on limits