Here is a sample README.md for your SQLite-based sales data analysis project:
This project demonstrates how to analyze simple sales data stored in an SQLite database using Python. It involves querying a database, loading results into a DataFrame, and visualizing revenue using a bar chart.
The SQLite database (sales_data.db) contains a single table:
| Column Name | Type | Description |
|---|---|---|
| id | INTEGER | Primary key |
| product | TEXT | Name of the product |
| quantity | INTEGER | Number of items sold |
| price | REAL | Price per item (in rupees) |
| date | TEXT | Sale date (YYYY-MM-DD format) |
-
Connect to sales_data.db
-
Run SQL queries to get product-wise total quantity and revenue
-
Display the results using:
- print() for tabular output
- matplotlib for bar chart visualization
- Python 3.x
- SQLite (sqlite3)
- Pandas
- Matplotlib
sql SELECT product, SUM(quantity) AS total_qty, SUM(quantity * price) AS revenue FROM sales GROUP BY product;
-
Ensure Python and required libraries are installed:
bash pip install pandas matplotlib
-
Run the Python script:
bash python sales_analysis.py
-
Output:
- Printed DataFrame of total sales per product
- Bar chart showing revenue per product
- Optional: sales_chart.png saved to disk
-
Console Output:
product total_qty revenue 0 Product A 150 3750.0 1 Product B 120 3000.0 2 Product C 80 2000.0
-
Bar Chart: A vertical bar chart comparing the revenue of each product.
├── sales_data.db # SQLite database file ├── sales_analysis.py # Python analysis script ├── sales_chart.png # Output bar chart (optional) └── README.md # This file
Author: Shubham S 📧 Email:
Let me know if you want a sample sales_analysis.py or the database file created as well.