Skip to content
0

Where to focus a marketing campaign?

📖 Background

You are a data analyst at a crowdfunding site. For the next quarter, your company will be running a marketing campaign. The marketing manager wants to target those segments that have donated the most in the past year. She turned to you to help her with her upcoming meeting with the CEO.

💾 The data

You have access to the following information:

Historic crowdfunding donations
  • "category" - "Sports", "Fashion", "Technology", etc.
  • "device" - the type of device used.
  • "gender" - gender of the user.
  • "age range" - one of five age brackets.
  • "amount" - how much the user donated in Euros.
import pandas as pd
import plotly.express as px
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv('./data/crowdfunding.csv')
categories = df.groupby('category').agg({'amount':'sum'}).sort_values(by='amount', ascending=False)
ages = df.groupby('age').agg({'amount':'sum'}).sort_values(by='amount', ascending=False)
devices = df.groupby('device').agg({'amount':'sum'}).sort_values(by='amount', ascending=False)
fig, axes = plt.subplots(3, 1, figsize=(16, 10))

sns.barplot(ax=axes[0], data=categories, x='amount', y=categories.index, estimator=np.sum, orient='h', ci=None, palette='Blues_r') 
axes[0].set_title('Games, Sports, and Technology are the top three income categories', fontsize=18, y=1.05)
axes[0].set_ylabel("Category", fontsize=15)

sns.barplot(ax=axes[1], data=ages, x='amount', y=ages.index, estimator=np.sum, orient='h', ci=None, palette='Greens_r')
axes[1].set_title('18-24 year olds is the group that should be targeted by the campaign', fontsize=18, y=1.05)
axes[1].set_ylabel("Age group", fontsize=15, labelpad=35)

sns.barplot(ax=axes[2], data=devices, x='amount', y=devices.index, estimator=np.sum, orient='h', ci=None, palette='Reds_r')
axes[2].set_title('iOS is the top income device', fontsize=18, y=1.05)
axes[2].set_ylabel("Device", fontsize=15, labelpad=25)

for ax in axes:
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.spines['left'].set_visible(False)
    ax.spines['bottom'].set_visible(False)
    ax.xaxis.set_visible(False)


for i, ax in enumerate(axes):
    for patch in ax.patches:
        x, y = patch.get_width(), patch.get_y()
        ax.annotate("{:d}K".format(int(x/1000)), (x, y), (x*1.05, y+0.5), fontsize=13)
    
fig.subplots_adjust(hspace=0.5)