pass_by_group

hhpy.ds.pass_by_group(df: pandas.core.frame.DataFrame, col: str, groupby: Union[str, list], btype: str, shift: bool = False, cutoff: int = 1, fs: int = 20, order: int = 5)[source]

allows applying a butter_pass filter by group

Parameters:
  • df – pandas DataFrame
  • col – column to filter
  • groupby – columns to groupby
  • btype – The type of filter. Passed to scipy.signal.butter. Default is ‘lowpass’. One of {‘lowpass’, ‘highpass’, ‘bandpass’, ‘bandstop’}
  • shift – shift: whether to shift the data to start at 0
  • cutoff – cutoff
  • fs – critical frequencies
  • order – order of the filter
Returns:

filtered DataFrame