Final Step

🏆 Capstone Projects

You've completed all 10 units. Now apply everything in a real-world project. Choose one (or all three!) — each uses a real public dataset and covers the full data analysis pipeline.

Project Rubric

What makes a capstone portfolio-ready?

1

Data Quality

Clear source, understood columns, missing values handled, outliers explained, and no silent data leakage.

2

Analysis Depth

Answers business questions with grouped analysis, comparisons, trends, and at least 5 evidence-backed insights.

3

Visual Story

Charts have meaningful titles, readable labels, useful annotations, and are ordered to support decisions.

4

Modeling Quality

Uses a baseline, proper train/test split, relevant metrics, and explains limits instead of overclaiming.

5

Reproducibility

Includes a clean notebook, organized files, requirements, fixed random seeds, and instructions to rerun.

6

Communication

Ends with a short executive summary: problem, method, top findings, recommendation, and next steps.

Minimum delivery checklist: clean notebook README requirements file 5-7 insights final chart/report

🏠 Project 1 — House Price Analysis

Estimated time: 4-6 hours | Difficulty: ⭐⭐⭐

  1. Load & Explore — Load the dataset, check dtypes, missing values, and basic stats. Answer: what's the average price? Which city has the most listings?
  2. Visualize — Plot price distribution (histogram), price vs size (scatter), average price by city (bar chart). Use seaborn for a correlation heatmap.
  3. Clean — Handle missing values, remove outliers (prices > 3× IQR), encode categorical columns (city, type).
  4. Feature Engineering — Create: price_per_sqm, is_new (year > 2018), district_avg_price.
  5. Model — Train LinearRegression and RandomForestRegressor. Compare RMSE and R² on the test set.
  6. Report — Write a 1-page summary: key findings, best model, what features matter most.

📦 Suggested Datasets

DatasetSourceSize
House Prices — Advanced Regressionkaggle.com →1,460 rows
Ames Housing Datasetopenml.org →2,919 rows
Cairo Real Estate (scrape)aqarmap.com.eg →Live data
python — starter code
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import r2_score, mean_squared_error import numpy as np # 1. Load data (replace with your CSV path) df = pd.read_csv('house_prices.csv') print(df.shape, df.dtypes) print(df.describe()) # 2. Quick EDA print("\nMissing values:\n", df.isnull().sum()[df.isnull().sum() > 0]) print("\nSample:\n", df.head()) # 3. Visualize price distribution plt.figure(figsize=(10, 4)) plt.subplot(1, 2, 1) df['SalePrice'].hist(bins=50, color='steelblue', edgecolor='black') plt.title('Price Distribution') plt.subplot(1, 2, 2) sns.scatterplot(data=df, x='GrLivArea', y='SalePrice', alpha=0.5) plt.title('Size vs Price') plt.tight_layout() plt.savefig('eda.png', dpi=150) plt.show() # 4. Simple model (extend this!) features = ['GrLivArea', 'BedroomAbvGr', 'FullBath', 'YearBuilt'] df_clean = df[features + ['SalePrice']].dropna() X = df_clean[features] y = df_clean['SalePrice'] X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.2, random_state=42) model = RandomForestRegressor(100, random_state=42) model.fit(X_tr, y_tr) print(f"\nR²: {r2_score(y_te, model.predict(X_te)):.3f}") print(f"RMSE: ${mean_squared_error(y_te, model.predict(X_te))**0.5:,.0f}")

📱 Project 2 — Customer Churn Prediction

Estimated time: 5-7 hours | Difficulty: ⭐⭐⭐⭐

  1. Load & Explore — Load the Telco churn dataset. What % of customers churned? Which features correlate most with churn?
  2. Clean & Encode — Convert TotalCharges to numeric, encode Yes/No columns as 0/1, one-hot encode multi-class columns.
  3. Visualize — Churn rate by contract type, monthly charges for churned vs retained (boxplot), correlation heatmap.
  4. Feature Engineering — Create: charges_per_month_ratio, has_multiple_services (sum of add-ons).
  5. Model & Compare — Train LogisticRegression, RandomForest, and GradientBoostingClassifier. Compare F1 score and ROC-AUC.
  6. Business Insight — Which customers are most at risk? What would you recommend to the business to reduce churn?

📦 Dataset

DatasetSourceSize
Telco Customer Churnkaggle.com →7,043 rows
IBM Churn Datasetibm.com →3,000 rows
python — starter code
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split, cross_val_score from sklearn.preprocessing import StandardScaler, LabelEncoder from sklearn.metrics import classification_report, roc_auc_score # Load df = pd.read_csv('WA_Fn-UseC_-Telco-Customer-Churn.csv') df['TotalCharges'] = pd.to_numeric(df['TotalCharges'], errors='coerce') df.dropna(inplace=True) df['Churn'] = (df['Churn'] == 'Yes').astype(int) print(f"Churn rate: {df['Churn'].mean():.1%}") # Encode binary columns binary_cols = ['Partner','Dependents','PhoneService','PaperlessBilling'] for col in binary_cols: df[col] = (df[col] == 'Yes').astype(int) # One-hot encode df = pd.get_dummies(df, columns=['InternetService','Contract','PaymentMethod']) # Features drop_cols = ['customerID','Churn'] X = df.drop(columns=drop_cols) y = df['Churn'] X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.2, random_state=42, stratify=y) sc = StandardScaler() X_tr = sc.fit_transform(X_tr); X_te = sc.transform(X_te) # Compare models for name, m in [ ('Logistic', LogisticRegression(max_iter=1000)), ('RandomForest',RandomForestClassifier(100, random_state=42)), ('GradBoost', GradientBoostingClassifier(100, random_state=42)) ]: m.fit(X_tr, y_tr) pred = m.predict(X_te) auc = roc_auc_score(y_te, m.predict_proba(X_te)[:,1]) print(f"{name:15} | F1: {classification_report(y_te,pred,output_dict=True)['1']['f1-score']:.3f} | AUC: {auc:.3f}")

📊 Project 3 — Sales Dashboard

Estimated time: 6-8 hours | Difficulty: ⭐⭐⭐⭐⭐

  1. Load into SQLite — Load the Superstore dataset into an SQLite database. Create tables: orders, products, customers.
  2. SQL Analysis — Write SQL queries: monthly revenue, top 10 products, revenue by region, average order value by customer segment.
  3. Time Series — Plot monthly revenue trend with 3-month rolling average. Find seasonality patterns.
  4. Plotly Dashboard — Build 4 interactive charts: revenue trend, top products bar, region pie chart, profit scatter.
  5. Export HTML — Use plotly.io.write_html() to export the dashboard as a standalone HTML file.
  6. Insights Report — Write 5 key business insights with supporting charts.

📦 Dataset

DatasetSourceSize
Superstore Saleskaggle.com →9,994 rows
Brazilian E-Commerce (Olist)kaggle.com →100k+ rows
python — starter code
import pandas as pd import sqlite3 import plotly.express as px import plotly.graph_objects as go from plotly.subplots import make_subplots # 1. Load into SQLite df = pd.read_csv('superstore.csv', encoding='latin-1') df['Order Date'] = pd.to_datetime(df['Order Date']) df['Month'] = df['Order Date'].dt.to_period('M').astype(str) conn = sqlite3.connect('superstore.db') df.to_sql('orders', conn, if_exists='replace', index=False) print("Loaded:", len(df), "orders") # 2. SQL analysis monthly = pd.read_sql_query(""" SELECT Month, SUM(Sales) as revenue, SUM(Profit) as profit, COUNT(*) as orders FROM orders GROUP BY Month ORDER BY Month """, conn) monthly['rolling_3m'] = monthly['revenue'].rolling(3).mean() top_products = pd.read_sql_query(""" SELECT "Product Name", SUM(Sales) as total FROM orders GROUP BY "Product Name" ORDER BY total DESC LIMIT 10 """, conn) # 3. Interactive dashboard fig = make_subplots( rows=2, cols=2, subplot_titles=['Monthly Revenue', 'Top 10 Products', 'Revenue by Region', 'Sales vs Profit'], specs=[[{"type":"scatter"},{"type":"bar"}],[{"type":"pie"},{"type":"scatter"}]] ) fig.add_trace(go.Scatter(x=monthly['Month'], y=monthly['revenue'], name='Revenue', line=dict(color='#3b82f6')), row=1, col=1) fig.add_trace(go.Scatter(x=monthly['Month'], y=monthly['rolling_3m'], name='3M Avg', line=dict(dash='dash', color='#f59e0b')), row=1, col=1) fig.add_trace(go.Bar(x=top_products['total'], y=top_products['Product Name'], orientation='h', marker_color='#06b6d4'), row=1, col=2) region = pd.read_sql_query("SELECT Region, SUM(Sales) as rev FROM orders GROUP BY Region", conn) fig.add_trace(go.Pie(labels=region['Region'], values=region['rev']), row=2, col=1) fig.add_trace(go.Scatter(x=df['Sales'], y=df['Profit'], mode='markers', marker=dict(opacity=0.4, color='#10b981')), row=2, col=2) fig.update_layout(title='📊 Superstore Sales Dashboard', height=700, template='plotly_dark', showlegend=False) fig.write_html('dashboard.html') print("Dashboard saved to dashboard.html") fig.show()
← Back to Unit 10 ⌂ All Units PyTrack — Python for Data Analysis