SAMANTUS Python for Data Analytics — Complete Training Manual CAPSTONE PROJECT 10
← Back to Course Index

Marketing Campaign Analysis


On This Page

Capstone Project 10: Marketing Campaign Analysis


C10.1  Project Overview

This project analyzes marketing spend and returns across multiple advertising channels to determine which platforms deliver the best ROI — directly relevant to Samantus's own digital marketing agency work.

C10.2  Business Problem

A marketing team is spreading budget across 5 channels and wants data-backed clarity on which channels actually deliver the best return, to reallocate spend more effectively.

C10.3  Dataset Description

ColumnDescription
channelMarketing channel (Instagram, Google Ads, etc.)
spendAmount spent on the campaign (Rs.)
conversionsNumber of conversions (sales/leads) generated
revenueRevenue generated from the campaign

Sample scope: 10 campaigns across 5 channels over one quarter.

C10.4  Objectives


C10.5  Step-by-Step Solution

C10.6  Complete Python Code

► marketing_campaign_analysis.py
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv("campaign_data.csv")

df['roi_pct'] = (df['revenue'] - df['spend']) / df['spend'] * 100

channel_roi = df.groupby('channel')['roi_pct'].mean().sort_values(ascending=False)
print("Average ROI % by Channel:\n", channel_roi.round(1))

best_channel = channel_roi.idxmax()
worst_channel = channel_roi.idxmin()
print("Best Channel:", best_channel)
print("Worst Channel:", worst_channel)

plt.scatter(df["spend"], df["conversions"])
plt.title("Spend vs Conversions")
plt.savefig("spend_scatter.png")

C10.7  Expected Output

Output
Best Channel: Instagram
Worst Channel: Facebook

C10.8  Visualizations

Figure C10.1 — Average ROI % by marketing channel.
Figure C10.1 — Average ROI % by marketing channel.
Figure C10.2 — Relationship between ad spend and conversions.
Figure C10.2 — Relationship between ad spend and conversions.

C10.9  Key Insights

C10.10  Business Recommendations

✓ Instructor Tip
This project connects directly to real agency work — encourage students running their own digital marketing services to adapt this exact script for client reporting.