Normalizes numerical features using Min-Max Scaling. Args: df (pd.DataFrame): Dataset containing numerical features. numerical_features (list): List of numerical feature column names. Returns: pd.DataFrame: The dataset with normalized numerical features.
(df, numerical_features)
| 90 | |
| 91 | |
| 92 | def normalize_numerical_features(df, numerical_features): |
| 93 | """ |
| 94 | Normalizes numerical features using Min-Max Scaling. |
| 95 | |
| 96 | Args: |
| 97 | df (pd.DataFrame): Dataset containing numerical features. |
| 98 | numerical_features (list): List of numerical feature column names. |
| 99 | |
| 100 | Returns: |
| 101 | pd.DataFrame: The dataset with normalized numerical features. |
| 102 | """ |
| 103 | scaler = MinMaxScaler() |
| 104 | df[numerical_features] = scaler.fit_transform(df[numerical_features]) |
| 105 | |
| 106 | return df |
| 107 | |
| 108 | |
| 109 | def reduce_cardinality(df, categorical_features, threshold=0.05, new_category="Other"): |
nothing calls this directly
no outgoing calls
no test coverage detected