Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pricing Strategy Analysis

What's the optimal price for each product category — and where is the business leaving money on the table through blunt, undisciplined discounting? This project goes beyond "what's our current pricing" to estimate real price elasticity, benchmark against competitors, quantify what discounts actually cost in margin, simulate revenue at different price points, and mine basket data for bundling opportunities. Built using Python (pandas, scikit-learn) and SQL.

Problem Statement

The business doesn't have a clear read on how price-sensitive its customers actually are, whether its prices are competitive, or whether its promotional discounts are profitable. This project turns a year of weekly price/sales data into a concrete, testable pricing strategy — not just a set of charts.

Tech Stack

  • Python: pandas, numpy, matplotlib, scikit-learn (log-log elasticity regression)
  • SQL: SQLite (queries portable to PostgreSQL/MySQL with minor tweaks)
  • Data: synthetic weekly price/demand history for 30 products across 5 categories (52 weeks) + 6,000 synthetic basket transactions — intentionally includes missing values, inconsistent text, and duplicates for cleaning practice
  • Dashboard layer (suggested): the cleaned CSVs in data/ are ready to drop straight into Power BI for an interactive pricing dashboard (price vs. competitor, discount ROI, bundle opportunities) on top of this analysis — not built here, but the data is shaped for it

Project Structure

pricing-strategy-analysis/
├── data/
│   ├── price_history.csv          # raw weekly price/demand data (with data quality issues)
│   ├── price_history_clean.csv    # cleaned data (output of analysis.py)
│   ├── products.csv                # product catalog (category, base price, cost)
│   ├── transactions.csv           # synthetic basket data for bundling analysis
│   └── summary_metrics.csv        # key headline metrics
├── sql/
│   └── schema_and_queries.sql     # table schema + 10 business-question queries
├── images/                        # generated charts
├── analysis.py                    # cleaning + elasticity + discount + bundling analysis
├── PRICING_RECOMMENDATIONS.md     # actionable pricing/discount/bundling strategy
└── README.md

How to Run

pip install pandas numpy matplotlib scikit-learn
python analysis.py

This cleans the data, prints elasticity/competitor/discount/bundling analysis to the console, and regenerates all charts in images/.

To run the SQL queries, load the cleaned CSVs into SQLite:

sqlite3 data/pricing.db
.mode csv
.import data/price_history_clean.csv price_history
.import data/products.csv products
.import data/transactions.csv transactions
.read sql/schema_and_queries.sql

Data Cleaning Steps

  • Removed exact duplicate rows
  • Standardized inconsistent category naming (electronics / ElectronicsElectronics)
  • Filled missing competitor_price values using the category-level median

Key Findings

  • Elasticity varies a lot by category — Electronics is by far the most price-sensitive (elasticity -2.32), while Beauty is the closest to unit-elastic (-1.03), meaning price cuts barely move Beauty's revenue
  • We're priced above competitors almost everywhere, especially Home & Kitchen (+9.7%) and Beauty (+8.5%) — worth a targeted price-match test
  • Discounts move volume but not profit: discount weeks see +53% units but only +7.1% revenue and -39.1% margin — the business is buying volume with margin, not really growing profit
  • Clear, low-risk bundling opportunities exist: pairs like Cotton T-Shirt
    • Yoga Pants and Shampoo + Conditioner are bought together ~5x more often than chance (lift score)

Price Elasticity by Category

Elasticity by Category

Price vs. Demand (Electronics)

Price vs Demand Electronics

Competitor Price Gap by Category

Competitor Price Gap

Discount Impact: Revenue vs. Margin

Discount Impact

Revenue Simulation — Optimal Price

Using the estimated elasticity, weekly revenue was simulated across a range of price points for Electronics (the most elastic category) to find the revenue-maximizing price.

Revenue Simulation

Interpretation: the simulation suggests a meaningfully lower price point than today's average would raise revenue. The direction is a useful signal; the exact magnitude should be validated with a small, reversible price test rather than rolled out directly — see PRICING_RECOMMENDATIONS.md for the caveat on why estimated elasticity from historical discounts can overstate this effect.

Bundling Opportunities

Market basket analysis on 6,000 synthetic transactions found the strongest co-purchase pairs by lift (how much more often two products are bought together than random chance would predict):

Top Bundle Opportunities

Pricing Recommendations

See PRICING_RECOMMENDATIONS.md for the full set of category-level pricing moves, the discount discipline recommendation, bundle packaging suggestions, and an honest caveat on the price-optimization simulation.

Possible Next Steps

  • Run a genuine controlled price A/B test to separate true elasticity from promotional lift
  • Extend the bundling analysis into actual bundle pricing tests
  • Segment elasticity by customer type (new vs. repeat) if that data becomes available
  • Build the suggested Power BI dashboard on top of data/price_history_clean.csv

Note: Dataset is synthetically generated for portfolio/demonstration purposes and does not represent a real business.

About

Data-driven pricing strategy analysis — price elasticity by category, competitor benchmarking, discount ROI, and bundling recommendations using Python & SQL.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages