Session Ready
Exercise

One-hot encoding credit data

It's time to prepare the non-numeric columns so they can be added to your LogisticRegression() model.

Once the new columns have been created using one-hot encoding, you can concatenate them with the numeric columns to create a new data frame which will be used throughout the rest of the course for predicting probability of default.

Remember to only one-hot encode the non-numeric columns. Doing this to the numeric columns would create an incredibly wide data set!

The credit loan data, cr_loan_clean, has already been loaded in the workspace.

Instructions
100 XP
  • Create a data set for all the numeric columns called cred_num and one for the non-numeric columns called cred_str.
  • Use one-hot encoding on cred_str to create a new data set called cred_str_onehot.
  • Union cred_num with the new one-hot encoded data and store the results as cr_loan_prep.
  • Print the columns of the new data set.