March 2019
Beginner to intermediate
464 pages
10h 57m
English
The first thing that we are going to take a look at is the aggregate conversion rate. The conversion rate is simply the percentage of customers that subscribed to a term deposit, or those encoded with 1 in the column conversion. Take a look at the following code:
sprintf("conversion rate: %0.2f%%", sum(df$conversion)/nrow(df)*100.0)
As you can see from this code snippet, we simply sum all of the values in the conversion column and divide by the number of records or customers in the DataFrame, df. Using the sprintf function, we format this conversion rate number with two decimal point numbers. The result looks as follows:

Read now
Unlock full access