SAMANTUS Python for Data Analytics — Complete Training Manual CAPSTONE PROJECT 11
← Back to Course Index

Retail Inventory Optimization


On This Page

Capstone Project 11: Retail Inventory Optimization


C11.1  Project Overview

This project analyzes product-level inventory data to flag overstocked and understocked SKUs, and studies weekly demand patterns to support smarter reordering decisions.

C11.2  Business Problem

A retail store is tying up cash in slow-moving stock while occasionally running out of fast-moving items. They want a data-driven way to flag which SKUs need attention.

C11.3  Dataset Description

ColumnDescription
skuUnique product/stock-keeping unit code
current_stockUnits currently in stock
avg_daily_salesAverage units sold per day
days_of_stockcurrent_stock / avg_daily_sales

Sample scope: 6 representative SKUs plus 200 weeks of overall demand data.

C11.4  Objectives


C11.5  Step-by-Step Solution

C11.6  Complete Python Code

► inventory_optimization.py
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv("inventory.csv")

df['days_of_stock'] = df['current_stock'] / df['avg_daily_sales']

def flag_status(days):
    if days < 15:
        return 'Stockout Risk'
    elif days > 90:
        return 'Overstocked'
    else:
        return 'Healthy'

df['status'] = df['days_of_stock'].apply(flag_status)
print(df[["sku","days_of_stock","status"]])

plt.bar(df["sku"], df["days_of_stock"])
plt.axhline(60, linestyle="--")
plt.savefig("stock_days.png")

C11.7  Expected Output

Output
sku     days_of_stock    status
SKU-101  45          Healthy
SKU-102  12          Stockout Risk
SKU-104  5           Stockout Risk
SKU-106  95          Overstocked

C11.8  Visualizations

Figure C11.1 — Days of inventory on hand per SKU, against a 60-day target line.
Figure C11.1 — Days of inventory on hand per SKU, against a 60-day target line.
Figure C11.2 — Distribution of weekly product demand.
Figure C11.2 — Distribution of weekly product demand.

C11.9  Key Insights

C11.10  Business Recommendations