utils.stats.preprocess_df_for_ols
utils.stats.preprocess_df_for_ols(df, independent_var_columns, target_col)Preprocesses a df for fiitting an OLS regression model using the specified target column and predictors.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| df | pd.DataFrame | Input DataFrame containing the data. | required |
| independent_var_columns | list of str | List of names for predictor columns. | required |
| target_col | str | Name of the target/dependent variable column. | required |
Returns
| Name | Type | Description |
|---|---|---|
| X_encoded | pd.DataFrame | Encoded predictors with a constant term. |
| y | pd.Series | Target variable. |