This project demonstrates an end-to-end E-Commerce Sales Analysis using Python, MySQL, and SQL.
The project starts by importing multiple CSV files into a MySQL database using Python, followed by performing business analysis using SQL queries. Finally, Python is used to visualize important business insights.
The primary objective is to demonstrate practical SQL, database management, and data analysis skills through real-world business scenarios.
The analysis focuses on answering key business questions, including:
- Customer distribution analysis
- Order trend analysis
- Revenue analysis
- Product category performance
- Seller performance
- Payment behavior
- Customer retention
- Year-over-Year sales growth
- Running total (Cumulative Sales)
- Business KPI reporting
- Python
- MySQL
- SQL
- Pandas
- Matplotlib
- Jupyter Notebook
This project uses an E-Commerce dataset consisting of multiple relational tables.
- Customers
- Orders
- Order Items
- Payments
- Products
- Sellers
- Geolocation
Kaggle Dataset
https://www.kaggle.com/models/narendrabariha/e-commerce-target-sales-dataset?select=sellers.csv
E-Commerce-Sales-Analysis/
โ
โโโ README.md
โโโ requirements.txt
โโโ LICENSE
โโโ database_setup.py
โโโ business_queries.sql
โโโ E-Commerce.ipynb
|โโ Dataset_Link.txt
CSV Files
โ
โผ
Python (Pandas)
โ
โผ
MySQL Database
โ
โผ
SQL Business Analysis
โ
โผ
Python Data Visualization
โ
โผ
Business Insights
The database_setup.py script automates the database creation process.
- Connects to MySQL
- Reads multiple CSV files
- Automatically creates database tables
- Detects SQL data types
- Cleans column names
- Handles NULL values
- Imports all records into MySQL
- List all unique customer cities
- Count total orders
- Analyze customer distribution by state
- Monthly order analysis
- Payment installment analysis
- Revenue by product category
- Average products purchased
- Average order value
- Seller revenue analysis
- Customer purchasing behavior
- Customer Retention Analysis
- Running Total (Cumulative Sales)
- Moving Average
- Seller Ranking
- Top Customers
- Year-over-Year Growth Analysis
This project demonstrates the use of:
- SELECT
- WHERE
- GROUP BY
- HAVING
- ORDER BY
- Aggregate Functions
- INNER JOIN
- LEFT JOIN
- Multiple Table Joins
- CASE WHEN
- Subqueries
- Window Functions
- SUM() OVER()
- AVG() OVER()
- ROW_NUMBER()
- RANK()
- DENSE_RANK()
- Running Total
- Moving Average
- Database Connectivity
- File Handling
- Data Import
- Data Cleaning
- Pandas DataFrames
- Data Visualization
- MySQL Integration
git clone https://github.com/VikashBsfore/E-Commerce-Sales-Analysis.gitpip install -r requirements.txtDownload the dataset from:
https://www.kaggle.com/models/narendrabariha/e-commerce-target-sales-dataset?select=sellers.csv
Place all CSV files inside the project dataset folder.
Create a MySQL database named:
ecommerce
Update the MySQL credentials in:
database_setup.py
Run:
python database_setup.pyLaunch Jupyter Notebook and open:
E-Commerce.ipynb
Execute all cells to reproduce the analysis.
- Analyzed customer purchasing behavior.
- Evaluated monthly sales trends.
- Identified top-performing sellers.
- Measured revenue contribution by product category.
- Calculated cumulative sales using SQL Window Functions.
- Analyzed customer retention and yearly sales growth.
- Generated business insights using SQL and Python.
- Advanced SQL
- Window Functions
- Analytical Queries
- Aggregate Functions
- Joins
- Business Reporting
- Pandas
- MySQL Connector
- Data Cleaning
- Data Analysis
- Visualization
- Business Analysis
- KPI Reporting
- Trend Analysis
- Customer Analytics
- Revenue Analysis
Through this project I learned:
- Importing CSV data into MySQL using Python
- Writing advanced SQL queries
- Working with relational databases
- Performing business-oriented data analysis
- Building analytical reports
- Creating visualizations using Python
- Build an interactive Power BI dashboard
- Develop a Tableau dashboard
- Perform customer segmentation
- Implement sales forecasting
- Create an interactive Streamlit application
Vikash Basfore
Aspiring Data Analyst
- GitHub: https://github.com/VikashBasfore
- LinkedIn: www.linkedin.com/in/vikash-basfore-99a95b3bb
If you found this project helpful, consider giving it a โญ on GitHub.