E-commerce Sales Analysis in Python
Explore an e-commerce sales dataset with monthly trends, top products, category breakdowns, and average order value analysis.
What this AI workflow does
This AI Data Analyst workflow loads the Online Retail Excel dataset from a URL and summarizes its structure with shape, dtypes, and missing values. It generates exploratory visuals for monthly revenue trends and identifies the top 10 products by total revenue. It computes average order value and compares AOV across countries with a focused country-level breakdown.
Who this example is for
This is for analysts and data scientists who want a conversational, code-generating EDA template for e-commerce transaction data in Python. It helps users quickly validate data quality and produce standard sales KPIs and plots for reporting or further modeling.
Expected analysis outcomes
These are the results the AI workflow is expected to generate.
- Dataset shape, dtypes, and null counts
- Monthly revenue trend line chart
- Top 10 products by total revenue bar chart
- Average order value overall and by country
- Bar chart of top countries by AOV
Tools and libraries used
Main Python packages and tooling used to run this AI data analysis task.
- pandas
- numpy
- matplotlib
- seaborn
- openpyxl
Prompt sequence
This is the exact list of prompts used in this workflow. The same prompt sequence is sent to each model so outputs and scores can be compared fairly.
- 1load the retail sales dataset from https://raw.githubusercontent.com/pplonski/datasets-for-start/refs/heads/master/online-retail/Online-Retail.xlsx and show basic info and shape
- 2plot monthly revenue trend
- 3show top 10 products by total revenue
- 4what is the average order value and how does it vary by country?
Model Comparison
We compared several LLM models on the same analysis task. The table below shows their scores side by side. You can also open each model run to check the full conversation and notebook results.
| Model Source | Score | Task | Execution | Output | Reasoning | Reliability | Run |
|---|---|---|---|---|---|---|---|
| glm-5.1 | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open glm-5.1 conversation |
| gpt-5.4 | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open gpt-5.4 conversation |
| gpt-oss:120b | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open gpt-oss:120b conversation |
| qwen3.5:397b | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open qwen3.5:397b conversation |
| gemma4:31b | 9/10 | 2/2 | 2/2 | 3/3 | 1/2 | 1/1 | Open gemma4:31b conversation |
| qwen3-coder-next | 9/10 | 2/2 | 2/2 | 3/3 | 1/2 | 1/1 | Open qwen3-coder-next conversation |
How scoring works
Each run is graded on five dimensions:
- Task Completion (0-2): how fully the workflow answered the requested analysis task and completed required steps.
- Execution Correctness (0-2): whether generated code is correct, consistent, and likely runnable without major fixes.
- Output Quality (0-3): how well tables, charts, and results match the expected analytical outcomes.
- Reasoning Quality (0-2): clarity and correctness of interpretation, explanation, and conclusions.
- Reliability (0-1): robustness of the run, including low hallucination risk and stable behavior.
The final score is the sum of these dimensions, so total score = 0-10. Higher values indicate more complete, correct, and reliable notebook results for this workflow.
AI Analysis with gpt-5.4
This run uses AI with a step-by-step list of prompts to perform the analysis task E-commerce Sales Analysis in Python. Below, you can review the full conversation generated with gpt-5.4. After the conversation, we show detailed score cards for this run.
Score cards for gpt-5.4 for E-commerce Sales Analysis in Python
Total score: 10/10
Task Completion: 2/2
ExcellentAll major requested steps were attempted: dataset loading/basic info, monthly revenue trend, top 10 products, and AOV by country. The expected analyses are present in the notebook outputs.
Execution Correctness: 2/2
ExcellentThe code shown is coherent and likely runnable, with valid pandas grouping and plotting logic. No major syntax or structural errors are evident from the provided content.
Output Quality: 3/3
ExcellentThe outputs match the expected outcomes semantically: shape/dtypes/nulls, a monthly revenue line chart with peaks, a top-10 product revenue table, and country-level AOV results. The bar chart for top 5 countries by AOV is not explicitly shown, but the country AOV data is produced.
Reasoning Quality: 2/2
ExcellentThe explanations correctly describe how revenue and order value were computed and note that returns/cancellations can affect totals. The reasoning is clear and aligned with the analysis steps.
Reliability: 1/1
ExcellentThe workflow is mostly consistent and grounded in the dataset outputs, with no obvious hallucinations. It is somewhat fragile in presentation because the final country AOV visualization is not explicitly created.
Try MLJAR Studio
Run the same type of AI-powered data analysis on your own datasets with conversational notebooks in MLJAR Studio.
Explore More AI Analysis Examples
Discover additional workflows across categories. Each example includes prompts, conversation outputs, and model-level scoring so you can compare approaches and results.