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

Financial Analytics


On This Page

Capstone Project 8: Financial Analytics


C8.1  Project Overview

This project analyzes a company's monthly revenue and expense data to track profitability trends and flag any months of margin concern.

C8.2  Business Problem

The finance team wants a clear month-by-month view of revenue, expenses, and profit margin to support budgeting and identify any concerning cost trends early.

C8.3  Dataset Description

ColumnDescription
monthCalendar month
revenueTotal revenue for the month (Rs. Lakhs)
expensesTotal operating expenses (Rs. Lakhs)
departmentDepartment the expense belongs to

Sample scope: 12 months of company-wide financial summary data.

C8.4  Objectives


C8.5  Step-by-Step Solution

C8.6  Complete Python Code

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

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

df['profit'] = df['revenue'] - df['expenses']
df['margin_pct'] = (df['profit'] / df['revenue']) * 100

print(df[["month","revenue","expenses","profit","margin_pct"]].round(2))

avg_margin = df['margin_pct'].mean()
print(f"Average Profit Margin: {avg_margin:.1f}%")

plt.plot(df["month"], df["revenue"], marker="o", label="Revenue")
plt.plot(df["month"], df["expenses"], marker="o", label="Expenses")
plt.legend()
plt.savefig("rev_exp_trend.png")

C8.7  Expected Output

Output
Average Profit Margin: 27.4%

C8.8  Visualizations

Figure C8.1 — Monthly revenue vs expenses trend across the year.
Figure C8.1 — Monthly revenue vs expenses trend across the year.
Figure C8.2 — Monthly profit margin percentage.
Figure C8.2 — Monthly profit margin percentage.

C8.9  Key Insights

C8.10  Business Recommendations