Skip to content
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
df = pd.read_csv('./data/crowdfunding.csv')
df.head()
💪 Challenge
Create a single visualization that the marketing manager can use to explore the data. Include:
- What are the top three categories in terms of total donations?
- What device type has historically provided the most contributions?
- What age bracket should the campaign target?
df.shape
df.info()
⌛️ Time is ticking. Good luck!
df.isnull().sum()
import pandas as pd
df.groupby(['category','device','age'])['amount'].sum().sort_values(ascending=False).reset_index()
import pandas as pd
df.groupby('category')['amount'].sum().sort_values(ascending=False).reset_index().iloc[:3]
df.groupby('device')['amount'].sum().sort_values(ascending=False).reset_index()
df.groupby('age')['amount'].sum().sort_values(ascending=False).reset_index()
The campaign should target the age group 25-34 since their average donation is higher than the 18-24 group.
df.groupby('age')['amount'].mean().sort_values(ascending=False).reset_index()