code: def lp_filter(df, sample_rate=24.0, time_constant=0.15):
      
  
      from scipy import signal
  
      # Butter is closer to what SBE is doing with their cosine filter.
      Wn = (1.0 / time_constant) / (sample_rate * 2.0)
      b, a = signal.butter(2, Wn, "low")
      new_df = df.copy()
      new_df.index = signal.filtfilt(b, a, df.index.values)
      return new_df
docs: Filter a series with `time_constant` (use 0.15 s for pressure), and for
      a signal of `sample_rate` in Hertz (24 Hz for 911+).
      NOTE: 911+ systems do not require filter for temperature nor salinity.
  
      Examples
      --------
      >>> from pathlib import Path
      >>> import matplotlib.pyplot as plt
      >>> import ctd
      >>> data_path = Path(__file__).parents[1].joinpath("tests", "data")
      >>> raw = ctd.from_cnv(data_path.joinpath('CTD-spiked-unfiltered.cnv.bz2'))
      >>> prc = ctd.from_cnv(data_path.joinpath('CTD-spiked-filtered.cnv.bz2'))
      >>> kw = {"sample_rate": 24.0, "time_constant": 0.15}
      >>> original = prc.index.values
      >>> unfiltered = raw.index.values
      >>> filtered = raw.lp_filter(**kw).index.values
      >>> fig, ax = plt.subplots()
      >>> l1, = ax.plot(original, 'k', label='original')
      >>> l2, = ax.plot(unfiltered, 'r', label='unfiltered')
      >>> l3, = ax.plot(filtered, 'g', label='filtered')
      >>> leg = ax.legend()
  
      Notes
      -----
      https://scipy-cookbook.readthedocs.io/items/FIRFilter.html