Friday, November 14, 2025

Projects on Series +Matplotlib

 

Project 1: Daily Temperature Analysis

Objective:

Analyze one week’s temperature and visualize the trend using a line chart.


Step 1: Create a Series

import pandas as pd import matplotlib.pyplot as plt temperature = pd.Series( [28, 30, 32, 31, 29, 27, 26], index=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] ) print(temperature)

Step 2: Basic Analysis

print("Average Temperature:", temperature.mean()) print("Highest Temperature:", temperature.max()) print("Lowest Temperature:", temperature.min())

Step 3: Plot Line Graph

temperature.plot(kind="line", marker="o") plt.title("Weekly Temperature Trend") plt.xlabel("Day") plt.ylabel("Temperature (°C)") plt.grid(True) plt.show()

What You Learn

  • Creating Series

  • Calculating mean/max/min

  • Line plot in Matplotlib

  • Working with labels


Project 2: Monthly Sales Comparison

Objective:

Analyze a shop’s monthly sales using a bar chart.


Step 1: Create the Series

sales = pd.Series( [12000, 15000, 13500, 16000, 17500, 19000], index=["Jan", "Feb", "Mar", "Apr", "May", "Jun"] ) print(sales)

Step 2: Perform Operations

print("Total Sales:", sales.sum()) print("Average Sales:", sales.mean()) print("Month with Highest Sales:", sales.idxmax())

Step 3: Plot Bar Chart

sales.plot(kind="bar") plt.title("Monthly Sales Report") plt.xlabel("Month") plt.ylabel("Sales (in Rupees)") 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...