This repository showcases a retail cost analysis workflow using the UCI Online Retail dataset. It combines a Python data processing script with an embedded Tableau dashboard and a margin recovery script to provide insights into product and vendor cost metrics.
-
process_retail_data.py A Python script that:
- Loads and cleans the raw
Online_Retail.xlsxdataset. - Standardizes records and handles missing or inconsistent entries.
- Calculates key cost metrics (e.g., modeled “should‑cost” vs. vendor quotes).
- Outputs the transformed data as
Processed_Retail_Data.csv.
- Loads and cleans the raw
-
calculate_margin_recovery.py A Python script that:
- Loads the cleaned
Processed_Retail_Data.csvfile. - Computes per‑unit “should_cost” by summing component costs.
- Extracts per‑unit quoted cost from vendor columns.
- Calculates total should‑cost, total quoted cost, and total savings (cost difference × quantity).
- Expresses the cost difference as a margin‑recovery percentage.
- Prints results to the console for quick verification.
- Loads the cleaned
-
Online_Retail.xlsx The original UCI Online Retail transactions dataset, containing order-level details for product purchases.
-
Processed_Retail_Data.csv The cleaned and enriched CSV featuring aggregated cost calculations and data quality checks.
What it shows:
-
Average Quote Variance: Bar chart displaying the percentage difference between each vendor’s quoted price and the modeled should‑cost for every SKU. Highlights where vendor quotes exceed or fall below cost estimates—allowing the user to prioritize negotiation or alternative sourcing for maximum savings.
-
Cost Driver Waterfall: Waterfall chart breaking down a selected SKU’s total cost into component steps—starting from the base should‑cost and then adding material, labor, packaging, and overhead. Exposes the largest cost driving components, guiding targeted cost‑reduction efforts.
-
Pareto Over‑Cost Impact: Pareto chart of the top 10 SKUs ranked by their total dollar over‑cost (vendor quote minus should‑cost), with a cumulative line illustrating each SKU’s share of excess spend. Applies the 80/20 principle to pinpoint the few SKUs responsible for the majority of excess spend.
How to acces:
Retail_Data.twbx – packaged Tableau workbook
View the fully interactive dashboard here: https://emma-lewis.github.io/Retail_Data/
A reproducible analysis workflow that:
- Cleans and transforms raw retail transaction data using Python.
- Identifies actionable cost-saving opportunities by comparing vendor quotes against modeled should‑costs.
- Visualizes results in an interactive Tableau dashboard for data-driven decision making.
Chen, D. (2015). Online Retail [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C5BW33.
