March 2019
Beginner to intermediate
464 pages
10h 57m
English
Let's take a look at another example. We will analyze how engagement rates differ by different sales channels. Take a look at the following code:
by_sales_channel_df = df.loc[ df['Response'] == 'Yes'].groupby([ 'Sales Channel']).count()['Customer']/df.groupby('Sales Channel').count()['Customer']
The result looks as follows:

It will be easier to look at this result with a visualization. You can use the following code to visualize this data:
ax = (by_sales_channel_df*100.0).plot( kind='bar', figsize=(7, 7), color='skyblue', grid=True)ax.set_ylabel('Engagement Rate (%)')plt.show()
The plot looks as follows:
Read now
Unlock full access