code: def press_check(df):
      
      new_df = df.copy()
      press = new_df.copy().index.values
  
      ref = press[0]
      inversions = np.diff(np.r_[press, press[-1]]) < 0
      mask = np.zeros_like(inversions)
      for k, p in enumerate(inversions):
          if p:
              ref = press[k]
              cut = press[k + 1 :] < ref
              mask[k + 1 :][cut] = True
      new_df[mask] = np.NaN
      return new_df
docs: Remove pressure reversals from the index.