Python Mastery – From Basics to Brilliance / Python Libraries for Real-World Use

Real-time Case Study: Analyzing Sales Data

Scenario: You run a small store and want to analyze monthly sales using Pandas and visualize using Matplotlib.

import pandas as pd
import matplotlib.pyplot as plt

# Sales data
data = {
    "Month": ["Jan", "Feb", "Mar", "Apr"],
    "Sales": [300, 450, 500, 600]
}

# Load into DataFrame
sales_df = pd.DataFrame(data)
print(sales_df)

# Plot sales
plt.plot(sales_df["Month"], sales_df["Sales"], marker='o')
plt.title("Monthly Sales Trend")
plt.xlabel("Month")
plt.ylabel("Sales")
plt.grid(True)
plt.show()

✅ This combines Pandas for data processing and Matplotlib for visualization