Analyzing Marketing Campaigns with pandas
Jill Rosok
Data Scientist
# Aggregate unique users that see ads by date
daily_users = marketing.groupby(['date_served'])\
['user_id'].nunique()
print(daily_users)
date_served
2018-01-01 362
2018-01-02 374
2018-01-03 348
...
Name: user_id, dtype: int64
import matplotlib.pyplot as plt
# Plot
daily_users.plot()
# Annotate
plt.title('Daily number of users who see ads')
plt.xlabel('Date')
plt.ylabel('Number of users')
plt.xticks(rotation = 45)
plt.show()
Analyzing Marketing Campaigns with pandas