preprocessing.outlier.manual_outlier_removal

preprocessing.outlier.manual_outlier_removal(
    data,
    column,
    lower_threshold=None,
    upper_threshold=None,
    verbose=False,
)

Manual outlier removal function.

Parameters

Name Type Description Default
data pd.DataFrame The input dataset. required
column str The column name in which to perform manual outlier removal. required
lower_threshold float | None The lower threshold below which values are considered outliers. If None, no lower threshold is applied. None
upper_threshold float | None The upper threshold above which values are considered outliers. If None, no upper threshold is applied. None
verbose bool Whether to print additional information. False

Returns

Name Type Description
tuple[pd.DataFrame, int] tuple[pd.DataFrame, int]: A tuple containing the modified dataset with outliers marked as NaN and the number of outliers marked.

Examples

>>> from spotforecast2_safe.data.fetch_data import fetch_data
>>> from spotforecast2_safe.preprocessing.outlier import manual_outlier_removal
>>> data = fetch_data()
>>> data, n_manual_outliers = manual_outlier_removal(
...     data,
...     column='ABC',
...     lower_threshold=50,
...     upper_threshold=700,
...     verbose=True