clip#
- pdcleaner.cleaning.cleaning.clip(self, detector, inplace=False)[source]#
Clean numerical series by clipping between lower and upper values
- Parameters:
detector (a Detector object,) – The detector obj that will identify entries to clean and provide upper and lower limits
inplace (bool (Default: False)) – Whether to perform the operation in place on the data.
- Return type:
The modified data or None if inplace is True
- Raises:
ValueError when input Detector does not have an upper or a lower attribute. –
Examples
>>> series = pd.Series([np.nan, 0, -5, 4, 6, 100, ]) >>> detector = series.cleaner.detect.bounded(lower=0, upper=10) >>> series.cleaner.clean.clip(detector) 0 NaN 1 0.0 2 0.0 3 4.0 4 6.0 5 10.0 dtype: float64
Modify inplace
>>> series.cleaner.clean.clip(detector, inplace=True) >>> series 0 NaN 1 0.0 2 0.0 3 4.0 4 6.0 5 10.0 dtype: float64