code: def bindata(df, delta=1.0, method="average"):
      
      start = np.floor(df.index[0])
      stop = np.ceil(df.index[-1])
      new_index = np.arange(start, stop, delta)
      binned = pd.cut(df.index, bins=new_index)
      if method == "average":
          new_df = df.groupby(binned).mean()
          new_df.index = new_index[:-1]
      elif method == "interpolate":
          raise NotImplementedError(
              "Bin-average via interpolation method is not Implemented yet."
          )
      else:
          raise ValueError(
              f"Expected method `average` or `interpolate`, but got {method}."
          )
      return new_df
docs: Bin average the index (usually pressure) to a given interval (default
      delta = 1).