March 2019
Beginner to intermediate
464 pages
10h 57m
English
The first thing that we are going to look at is the aggregate engagement rate. This engagement rate is simply the percentage of customers that responded to the marketing calls. Take a look at the following code:
engagement_rate_df = pd.DataFrame( df.groupby('Engaged').count()['Response'] / df.shape[0] * 100.0)
As you can see from this code, we are grouping by the newly created field, Engaged, using the groupby function of a pandas DataFrame. Then, we are counting the number of records (or customers) in each Engaged group with the count function. By dividing by the total number of customers in the DataFrame and multiplying by 100.0, we get the engagement rate. The results are as follows:
To make this easier to read, we can ...
Read now
Unlock full access