Skip to content

Add product profitability analysis notebook#6

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/create-jupyter-notebook-analysis
Draft

Add product profitability analysis notebook#6
Copilot wants to merge 3 commits intomainfrom
copilot/create-jupyter-notebook-analysis

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 5, 2026

Creates notebook to identify high-revenue, low-profit products and sub-categories for strategic review.

Implementation

  • Analysis flow: Load data → clean → group by product/sub-category → calculate sales/profit totals → flag items with high revenue (≥75th percentile) but low margin (<10%)
  • Visualizations: Scatter plot (sales vs profit), profit margin bars, top 15 products chart (color-coded by margin health), sales/profit comparison bars
  • Output: Summary statistics, top/bottom performers, actionable recommendations

Technical details

  • Data source: data/superstore_sales.csv (consistent with superstore_analysis.ipynb)
  • Libraries: pandas, numpy, matplotlib, seaborn
  • Kernel config: .venv (Python 3.13.8) matching project standards
# Core analysis pattern
product_summary = df.groupby('Product Name').agg({
    'Sales': 'sum',
    'Profit': 'sum'
}).reset_index()

product_summary['Profit Margin %'] = (
    product_summary['Profit'] / product_summary['Sales'] * 100
)

# Identify problematic products
sales_threshold = product_summary['Sales'].quantile(0.75)
problematic = product_summary[
    (product_summary['Sales'] >= sales_threshold) &
    (product_summary['Profit Margin %'] < 10)
]
Original prompt

Create a Jupyter notebook under the notebooks/ directory of the repository WebCraftPhil/superstore-sales-analysis to analyze products and sub-categories based on revenue and profit. The notebook should include:

  1. Markdown cells explaining the process:

    • Goal: Identify high-revenue, low-profit products/sub-categories.
    • Steps: Grouping by product/sub-category, comparing sales vs. profit, and flagging items with high sales but low/negative profits.
  2. Code cells to:

    • Load data from the data/ directory (e.g., sales data CSV).
    • Clean and prepare the data if necessary (handle missing values, etc.).
    • Group the data by product or sub-category.
    • Calculate total sales and total profit for each group.
    • Highlight groups with high total sales and low/negative profits.

The notebook should leverage Python libraries for data analysis (e.g., pandas, numpy) and visualization (e.g., matplotlib, seaborn) to better understand insights.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Jan 5, 2026
Copilot AI and others added 2 commits January 5, 2026 16:14
Co-authored-by: WebCraftPhil <118385120+WebCraftPhil@users.noreply.github.com>
Co-authored-by: WebCraftPhil <118385120+WebCraftPhil@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Jupyter notebook for product revenue and profit analysis Add product profitability analysis notebook Jan 5, 2026
Copilot AI requested a review from WebCraftPhil January 5, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants