Skip to content

Analyzed monthly revenue and order trends from sales data using Python for cleaning and SQL (MySQL) for time-based aggregation and insight extraction.

Notifications You must be signed in to change notification settings

yuvraj0412s/sales-trend-analysis-sql-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Sales Trend Analysis Using SQL & Python

Python SQL Pandas Status

A real-world data project where I cleaned and transformed a sales dataset using Python, and performed time-based trend analysis using SQL revealing insights on monthly revenue and order volume.


🧠 Objective

To explore trends in monthly sales and order volume using SQL-based aggregation, supported by Python-powered data cleaning.


πŸš€ What I Did

βœ… Cleaned the raw CSV using Python
βœ… Transformed messy data into SQL-friendly format
βœ… Wrote a SQL script to analyze sales and order trends
βœ… Exported final cleaned dataset ready for dashboards or reports


πŸ› οΈ Skillset Demonstrated

Category Skills / Tools
πŸ‘¨β€πŸ’» Programming Python, Pandas
πŸ—„οΈ Database Querying SQL (MySQL, SQLite compatible)
🧹 Data Cleaning Column renaming, date parsing, null handling
πŸ“Š Analysis Time-based aggregation (revenue, orders)
πŸ“ File Handling CSV import/export

πŸ“ Dataset Overview

  • Input File: Sample_sales.csv
  • Output File: cleaned_sales_for_mysql.csv
  • Important Fields: order_id, order_date, amount, product_id

🧹 Data Cleaning Steps (Python)

import pandas as pd

# Load dataset
df = pd.read_csv("Sample_sales.csv", encoding="latin1")

# Clean column names
df.columns = df.columns.str.strip().str.lower().str.replace(' ', '_')

# Convert order_date to datetime
df['order_date'] = pd.to_datetime(df['order_date'], errors='coerce')

# Select and rename relevant columns
clean_df = df[['ordernumber', 'order_date', 'sales', 'productcode']].copy()
clean_df.columns = ['order_id', 'order_date', 'amount', 'product_id']

# Drop rows with missing values
clean_df.dropna(inplace=True)

# Save the cleaned data for SQL import
clean_df.to_csv("cleaned_sales_for_mysql.csv", index=False)

About

Analyzed monthly revenue and order trends from sales data using Python for cleaning and SQL (MySQL) for time-based aggregation and insight extraction.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages