Thursday, November 27, 2025

✅ πŸ“˜ Advanced (Hard) Level Projects of DataFrame

 

Beginner Level Projects of DataFrame

 Intermediate Level Projects

7️⃣ Project: Stock Market Trend Analysis

Objective: Compare Open, Close prices + Moving Average.

Concepts Used:

  • Time-series indexing

  • Rolling window

  • Multiple line plots

Example Code:

import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv("stocks.csv") # date, open, close df['date'] = pd.to_datetime(df['date']) df.set_index('date', inplace=True) df['MA20'] = df['close'].rolling(20).mean() plt.plot(df.index, df['close'], label='Close Price') plt.plot(df.index, df['MA20'], label='20-Day MA') plt.legend() plt.title("Stock Trend Analysis") plt.show()

8️⃣ Project: Weather Data – Heatmap

Objective: Show temperature of 12 months & 30 days in a heatmap.

Concepts Used: Pivot table, .imshow(), color mapping.

Example Code:

import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv("weather.csv") # columns: month, day, temp pivot = df.pivot('day', 'month', 'temp') plt.imshow(pivot, aspect='auto') plt.colorbar(label='Temperature') plt.title("Monthly Temperature Heatmap") plt.show()

9️⃣ Project: Advanced Sales Dashboard (Bar + Line + Pie)

Objective: Build a mini dashboard using matplotlib subplots.

Concepts Used:

  • Subplots

  • Aggregation

  • Advanced plotting

Example Code:

import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv("store_data.csv") plt.figure(figsize=(12,8)) # 1. Bar – category sales plt.subplot(2,2,1) cat = df.groupby('category')['sales'].sum() plt.bar(cat.index, cat.values) plt.title("Category Sales") # 2. Line – monthly trend plt.subplot(2,2,2) monthly = df.groupby('month')['sales'].sum() plt.plot(monthly.index, monthly.values, marker='o') plt.title("Monthly Sales Trend") # 3. Pie – region split plt.subplot(2,2,3) region = df.groupby('region')['sales'].sum() plt.pie(region.values, labels=region.index, autopct="%1.1f%%") plt.title("Region Sales Share") plt.tight_layout() plt.show()

No comments:

Post a Comment

Python Viva Questions

  Basic Python Viva Questions 1. What is Python? Python is a high-level, interpreted, and object-oriented programming language used for w...