March 2019
Beginner to intermediate
464 pages
10h 57m
English
Similar to how we encoded the categorical variable, job, we are going to create dummy variables for each category of the marital variable. Like before, we are using the following code to encode the marital column:
marital_encoded_df = pd.get_dummies(df['marital'])marital_encoded_df.columns = ['marital_%s' % x for x in marital_encoded_df.columns]
The encoding results are as follows:

As you can see, three new variables are created for the original variable, marital: marital_divorced, marital_married, and marital_single, representing whether a given customer is divorced, married, or single, respectively. In order to add these ...
Read now
Unlock full access