BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Analyzing Marketing Campaigns with pandas

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Unstack channel_age with level = 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.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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()
Kodu Düzenle ve Çalıştır