code: def rescale(x, min=0., max=1., axis=0):
      
      def innerfn(x, min, max):
          return np.interp(x, [np.min(x), np.max(x)], [min, max])
  
      if isinstance(x, pd.DataFrame):
          return x.apply(innerfn, axis=axis, args=(min, max,))
      else:
          return pd.Series(innerfn(x, min, max), index=x.index)
docs: Rescale values to fit a certain range [min, max]