Exercise

Encode categorical and scale numerical variables

In this final step, you will perform one-hot encoding on the categorical variables and then scale the numerical columns. The pandas library has been loaded for you as pd, as well as the StandardScaler module from the sklearn.preprocessing module.

The raw telecom churn dataset telco_raw has been loaded for you as a pandas DataFrame, as well as the lists custid, target, categorical, and numerical with column names you have created in the previous exercise. You can familiarize yourself with the dataset by exploring it in the console.

Instructions

100 XP
  • Perform one-hot encoding on the categorical variables.
  • Initialize a StandardScaler instance.
  • Fit and transform the scaler on the numerical columns.
  • Build a DataFrame from scaled_numerical.