Marketing channels across age groups
Some marketing stakeholders want to know if their marketing channels are reaching all users equally or if some marketing channels are serving specific age demographics.
Within a marketing team, it is common to get requests that require quick analysis and visualization. The better you are at visualizing the results, the more likely that you will effectively communicate your findings to your stakeholders.
In this exercise, you will create a grouped bar chart showing how many people each marketing channel reached by age group.
Este exercício faz parte do curso
Analyzing Marketing Campaigns with pandas
Instruções do exercício
- Unstack
channel_age
withlevel = 1
and transform the result into a DataFrame. - Plot
channel_age
as a grouped bar chart. - Add a legend in the upper right and set the labels equal to
channel_age_df.columns.values
.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
channel_age = marketing.groupby(['marketing_channel', 'age_group'])\
['user_id'].count()
# Unstack channel_age and transform it into a DataFrame
channel_age_df = ____.____(channel_age.____(____ = ____))
# Plot channel_age
____.____(____ = '____')
plt.title('Marketing channels by age group')
plt.xlabel('Age Group')
plt.ylabel('Users')
# Add a legend to the plot
____.____(____ = '____',
____ = ____)
plt.show()