March 2019
Beginner to intermediate
464 pages
10h 57m
English
Let's first take a look at the aggregate conversion rate. The conversion rate is simply the percentage of customers that subscribed to a term deposit. Take a look at the following code:
conversion_rate_df = pd.DataFrame( df.groupby('conversion').count()['y'] / df.shape[0] * 100.0)
As you can see from this code snippet, we are grouping by a column, conversion, which is encoded with 1 for those that have subscribed to a term deposit, and with 0 for those that have not. Then, we are counting the number of customers in each group and dividing it by the total number of customers in the dataset. The result looks as follows:

To make ...
Read now
Unlock full access