Normalize Scaling
- class normalize_scaling.ScalingNormalizer(method: str | Dict[str, str] = 'standard', columns: List[str] | None = None, **kwargs: Any)[source]
A utility class for scaling and normalizing data using various methods such as Min-Max scaling, standard scaling, robust scaling, max absolute scaling, and normalization. Non-specified columns are left unchanged.
- static create_column_transformer(column_methods: Dict[str, str], remainder: str = 'passthrough', **kwargs: Any) ColumnTransformer[source]
Creates a ColumnTransformer to apply different scaling or normalization methods to different columns.
- Parameters:
column_methods (Dict[str, str]) – A dictionary mapping column names to scaling or normalization methods. Example: {‘column1’: ‘minmax’, ‘column2’: ‘standard’}
remainder (str) – Strategy for handling remaining columns. Defaults to ‘passthrough’.
**kwargs (Any) – Additional parameters to pass to the scaling or normalization methods.
- Returns:
A ColumnTransformer object to apply specified methods to different columns.
- Return type:
ColumnTransformer
- fit(X: DataFrame, y: Series | None = None) ScalingNormalizer[source]
Fits the scaler or normalizer to the specified columns of the input data.
- Parameters:
X (pd.DataFrame) – The input data to be scaled or normalized.
y (pd.Series, optional) – Not used in the scaling process, provided for compatibility.
- Returns:
Returns the instance after fitting.
- Return type:
- fit_transform(X: DataFrame, y: Series | None = None) DataFrame[source]
Fits the scalers or normalizers to the specified columns of the data and transforms it.
- Parameters:
X (pd.DataFrame) – The input data to scale or normalize.
y (pd.Series, optional) – Not used in the scaling process, provided for compatibility.
- Returns:
The transformed data with specified columns scaled or normalized.
- Return type:
pd.DataFrame
- get_params(deep: bool = True) Dict[str, Any][source]
Get parameters for this estimator.
- Parameters:
deep (bool) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
Parameter names mapped to their values.
- Return type:
Dict[str, Any]
- inverse_transform(X: DataFrame) DataFrame[source]
Inverses the transformation on the specified columns of the input data.
- Parameters:
X (pd.DataFrame) – The transformed data to inverse transform.
- Returns:
Original data with specified columns inverse transformed.
- Return type:
pd.DataFrame
- set_params(**params: Any) ScalingNormalizer[source]
Set the parameters of this estimator.
- Parameters:
**params – Estimator parameters.
- Returns:
Returns self.
- Return type: