ehrapy.preprocessing.clip_quantile

Contents

ehrapy.preprocessing.clip_quantile#

ehrapy.preprocessing.clip_quantile(edata, limits, vars=None, obs_cols=None, *, layer=None, copy=False)[source]#

Clips (limits) features.

Given an interval, values outside the interval are clipped to the interval edges.

Parameters:
  • edata (EHRData) – Central data object.

  • limits (tuple[float, float]) – Values outside the interval are clipped to the interval edges.

  • vars (Collection[str], default: None) – Columns in var with features to clip.

  • obs_cols (Collection[str], default: None) – Columns in obs with features to clip

  • layer (str | None, default: None) – The layer to operate on.

  • copy (bool, default: False) – Whether to return a copy of data or not

Return type:

EHRData | None

Returns:

A copy of original data object with clipped features.

Examples

>>> import ehrdata as ed
>>> import ehrapy as ep
>>> edata = ed.dt.mimic_2()
>>> ep.pp.clip_quantile(edata, limits=(0, 75), vars=["bmi"])