LECA.prep.filter_fn

LECA.prep.filter_fn(data: DataFrame, cols: str | List[str], func: Callable[[...], bool]) Tuple[DataFrame, DataFrame]

Applies the provided function to each value in the given column(s). If the function returns true, that measurement is removed from the filtered DataFrame (and added to the caught DataFrame).

Parameters:
  • data (DataFrame) – DataFrame of experimental measurements.

  • cols (Union[str, List[str]]) – List of columns in DataFrame to apply filter function to.

  • func (Callable[..., bool]) – Function taking one argument (each value in the selected columns) and returning boolean (True indicating to remove value).

Returns:

The first DataFrame is the caught values which are removed from the second DataFrame, which is the filtered (clean) DataFrame.

Return type:

Tuple[DataFrame, DataFrame]