Skip to content

chanity256/data_analysis

Repository files navigation

E-Commerce Analytics Dashboard

A professional Streamlit dashboard for analyzing e-commerce performance metrics, revenue trends, and customer satisfaction data. This dashboard provides real-time insights with interactive visualizations and comprehensive filtering capabilities.

Features

📊 Key Performance Indicators

  • Total Revenue with year-over-year growth trends
  • Monthly Growth percentage with color-coded indicators
  • Average Order Value with trend analysis
  • Total Orders with growth comparison

📈 Analytics Overview (2x2 Grid)

  • Revenue Trend Line Chart: Dual-line comparison between current and previous periods
  • Top 10 Categories: Horizontal bar chart with blue gradient coloring
  • Revenue by State: Interactive US choropleth map with state-level insights
  • Satisfaction vs Delivery Time: Bar chart correlating delivery speed with customer ratings

💾 Additional Metrics

  • Average Delivery Time: Performance tracking with trend indicators
  • Review Score: Star-rated customer satisfaction display

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup Instructions

  1. Clone or download the project files

    # Ensure you have all project files in the DATA_ANALYSIS directory
    # Including ecommerce_data/ folder with CSV files
  2. Install required dependencies

    pip install -r requirements.txt
  3. Verify data structure Ensure the following CSV files are present in the ecommerce_data/ directory:

    • customers_dataset.csv
    • order_items_dataset.csv
    • order_payments_dataset.csv
    • order_reviews_dataset.csv
    • orders_dataset.csv
    • products_dataset.csv

Usage

Running the Dashboard

  1. Navigate to the project directory

    cd /path/to/DATA_ANALYSIS
  2. Launch the Streamlit dashboard

    streamlit run streamlit_dashboard.py
  3. Access the dashboard

    • The dashboard will automatically open in your default web browser
    • If not, navigate to http://localhost:8501 in your browser

Using the Dashboard

Date Range Filtering

  • Analysis Year: Select the primary year for analysis (2023, 2022, 2021)
  • Comparison Year: Choose the year for comparison (2022, 2021, 2020)
  • Month Range: Set start and end months to focus on specific periods
  • All visualizations update automatically when filters change

Interactive Elements

  • KPI Cards: Display metrics with color-coded trend indicators (green=positive, red=negative)
  • Charts: Hover over data points for detailed information
  • US Map: Click on states or hover for revenue details
  • Responsive Design: Dashboard adapts to different screen sizes

Dashboard Layout

┌─────────────────────────────────────────────────────────────────┐
│ Header: Title                                    Date Filters │
├─────────────────────────────────────────────────────────────────┤
│ KPI Row: 4 cards with metrics and trend indicators            │
├─────────────────────────────────────────────────────────────────┤
│ Charts Grid (2x2):                                          │
│ ┌─────────────────────┐ ┌─────────────────────┐             │
│ │   Revenue Trend    │ │ Top 10 Categories  │             │
│ └─────────────────────┘ └─────────────────────┘             │
│ ┌─────────────────────┐ ┌─────────────────────┐             │
│ │ Revenue by State   │ │ Satisfaction vs    │             │
│ │     (Choropleth)   │ │   Delivery Time    │             │
│ └─────────────────────┘ └─────────────────────┘             │
├─────────────────────────────────────────────────────────────────┤
│ Bottom Row: 2 cards (Delivery Time & Review Score)           │
└─────────────────────────────────────────────────────────────────┘

Technical Details

Architecture

  • Data Processing: Modular approach with data_loader.py and business_metrics.py
  • Visualization: Plotly for all charts and interactive elements
  • Frontend: Streamlit framework for responsive web interface
  • Styling: Custom CSS for professional appearance

Key Components

  • Caching: Streamlit caching for optimal performance
  • Error Handling: Robust data validation and filtering
  • Responsive Design: Consistent layout across devices
  • Color Coding: Green for positive trends, red for negative trends

Data Requirements

The dashboard expects the following data schema:

  • Orders with timestamps and status
  • Customer information with state locations
  • Product categories and pricing
  • Review scores and delivery metrics
  • Payment information

Troubleshooting

Common Issues

  1. ModuleNotFoundError

    # Ensure all dependencies are installed
    pip install -r requirements.txt
  2. File not found errors

    # Verify CSV files are in the correct location
    ls ecommerce_data/
  3. Dashboard not loading

    # Check Python version (requires 3.8+)
    python --version
    
    # Try clearing Streamlit cache
    streamlit cache clear
  4. Performance issues

    • Use date filters to reduce data volume
    • Refresh browser if charts don't load
    • Check system resources for large datasets

Performance Tips

  • Use specific date ranges for faster loading
  • The dashboard automatically caches processed data
  • Clear cache if you update source CSV files

Dependencies

  • streamlit>=1.28.0 - Web framework
  • pandas>=1.5.0 - Data processing
  • plotly>=5.0.0 - Interactive visualizations
  • numpy>=1.21.0 - Numerical operations
  • matplotlib>=3.5.0 - Additional plotting support
  • seaborn>=0.11.0 - Statistical visualizations

Support

For issues or questions:

  1. Check the troubleshooting section above
  2. Verify all data files are in the correct format
  3. Ensure Python and dependency versions are compatible
  4. Review the console output for specific error messages

Note: This dashboard is designed for e-commerce analysis and requires properly formatted data files. All visualizations use real-time data processing and update immediately when filters are applied.

About

来自https://learn.deeplearning.ai/courses/claude-code-a-highly-agentic-coding-assistant 课程的lesson7和lesson8的练习项目。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors