Lesson 15 of 60
pythonHands‑On NumPy Project: Synthetic Sales Dataset
30 minutes
Course progress25%
Hands‑On NumPy Project
In this project you will create a synthetic sales dataset, clean it, and compute key metrics using NumPy.
Step 1: Generate synthetic data
import numpy as np
rng = np.random.default_rng(2024)
n = 1000
# Columns: [store_id, product_id, units_sold, price]
store_ids = rng.integers(, , size=n)
product_ids = rng.integers(, , size=n)
units = rng.poisson(lam=, size=n)
price = rng.uniform(, , size=n).()
sales = np.column_stack((store_ids, product_ids, units, price))
(sales[:])