pymargins.trim

pymargins.trim(*, lower=None, upper=None, columns=None)

Create a trim pipeline stage.

Drops rows where any of the specified columns falls outside the [lower, upper] bounds. Under bootstrap the bounds are re-applied to every resample.

Parameters:
  • lower (float, optional) – Lower bound (inclusive).

  • upper (float, optional) – Upper bound (inclusive).

  • columns (list of str, optional) – Columns to check. If None, all numeric columns are checked.

Returns:

A stage with alters_rows=True and requires_resampling=False.

Return type:

Stage