March 2019
Beginner to intermediate
464 pages
10h 57m
English
Before we start to analyze the data, we will first encode the output variable, y, which has information about whether a customer has converted or subscribed to a term deposit, with numerical values. You can use the following code to encode the output variable, y, with zeros and ones:
df['conversion'] = df['y'].apply(lambda x: 0 if x == 'no' else 1)
As you can see from this code snippet, you can use the apply function to encode the output variable. We stored these encoded values in a new column, named conversion.
Read now
Unlock full access