NumPy Project – End-to-End Numerical Analysis
In this final lesson, you will build a complete NumPy-based project that applies everything you learned so far. The goal is to simulate a real-world numerical workflow using only NumPy.
This project mirrors how NumPy is used in analytics, engineering, and machine learning pipelines before higher-level libraries are applied.
Project Scenario
You are given numerical data representing daily sales (in units) for a product across multiple stores. Your task is to analyze, transform, and summarize the data.
The dataset contains:
- Rows → Days
- Columns → Stores
Step 1: Create the Dataset
import numpy as np
sales = np.array([
[120, 135, 150],
[130, 140, 160],
[125, 138, 155],
[140, 150, 170],
[145, 160, 180]
])
print(sales)
Each column represents a store, and each row represents a day of sales.
Step 2: Basic Statistics
Calculate total, average, and maximum sales.
total_sales = sales.sum()
avg_sales = sales.mean()
max_sales = sales.max()
print(total_sales, avg_sales, max_sales)
These statistics provide a quick overview of business performance.
Step 3: Store-Wise Analysis
Analyze sales per store.
store_totals = sales.sum(axis=0)
store_averages = sales.mean(axis=0)
print(store_totals)
print(store_averages)
This shows which store performs best over time.
Step 4: Day-Wise Trends
Analyze daily performance across all stores.
daily_totals = sales.sum(axis=1)
print(daily_totals)
This helps identify high-performing or low-performing days.
Step 5: Normalizing the Data
Normalize the sales data to compare trends fairly.
mean = sales.mean(axis=0)
std = sales.std(axis=0)
normalized_sales = (sales - mean) / std
print(normalized_sales)
Normalization is essential in machine learning and analytics workflows.
Step 6: Performance Comparison Using Vectorization
Apply a growth factor to simulate a 10% increase in sales.
projected_sales = sales * 1.10
print(projected_sales)
Vectorized operations allow fast transformations without loops.
Step 7: Identifying Best Performing Store
Find the store with the highest total sales.
best_store = np.argmax(store_totals)
print("Best performing store index:", best_store)
This technique is commonly used in ranking and optimization problems.
Project Summary
In this project, you:
- Created and structured numerical data
- Performed aggregation and statistics
- Used axis-based operations
- Applied normalization
- Used vectorized computation
These steps represent a complete NumPy workflow used in real applications.
Where NumPy Fits Next
After NumPy, most workflows move to:
- Pandas for labeled data analysis
- Matplotlib for visualization
- Scikit-learn for machine learning
A strong NumPy foundation makes all of these easier to master.
Course Completion
You have successfully completed the NumPy course. You now understand numerical computing at a professional level.