A Python data analysis project that generates a realistic synthetic e-commerce transaction dataset and produces revenue insights and visualizations with pandas and matplotlib.
Analysis of 7,843 orders from 2,000 customers between January 2024 and December 2025:
| Metric | Value |
|---|---|
| Total revenue | $1,353,582.17 |
| Average order value | $172.58 |
| Top category | Electronics ($571,960.56 — 42% of revenue) |
| Top customer spend | $5,782.73 |
Revenue by category:
| Category | Revenue |
|---|---|
| Electronics | $571,960.56 |
| Home & Kitchen | $359,623.27 |
| Apparel | $273,902.57 |
| Beauty | $85,785.61 |
| Books | $62,310.16 |
Electronics and Home & Kitchen together account for roughly 69% of all revenue, while Beauty and Books drive order volume at lower price points.
ecommerce-analytics/
├── data/
│ └── transactions.csv # generated dataset (not tracked in git)
├── output/ # generated charts
├── src/
│ ├── generate_data.py # synthetic dataset generator
│ └── analysis.py # summary stats + charts
├── requirements.txt
└── README.md
# 1. Set up environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# 2. Generate the dataset
python3 src/generate_data.py
# 3. Run the analysis
python3 src/analysis.pyThe analysis prints an overview to the terminal (order counts, revenue totals, category breakdown, top customers) and saves charts to output/.
- Python 3.13
- pandas — data loading, aggregation, and time-series grouping
- matplotlib — chart generation
- NumPy — synthetic data generation (gamma/beta/Poisson distributions for realistic customer behavior and Q4 seasonality)


