An end-to-end data analytics project that analyzes customer shopping behavior to identify purchasing patterns, customer segments, product performance, and business opportunities using Python, PostgreSQL, SQL, and Power BI.
Understanding customer purchasing behavior is essential for improving customer retention, optimizing product strategies, and making data-driven business decisions.
This project analyzes a customer shopping behavior dataset containing demographic information, purchasing history, product details, transaction information, discounts, subscriptions, and customer preferences.
The project follows an end-to-end analytics workflow:
Data Cleaning β Exploratory Data Analysis β SQL Analysis β Power BI Dashboard β Business Insights
- Analyzed 3,900 customer records
- Performed data cleaning and feature engineering using Python/Pandas
- Stored and queried analytical data using PostgreSQL
- Developed 10 business-focused SQL analyses
- Used CTEs, CASE statements, subqueries, aggregations, and window functions
- Built an interactive Power BI dashboard
- Identified customer spending, loyalty, subscription, product, discount, and demographic patterns
The main objectives of this project are to:
- Analyze customer purchasing patterns
- Identify high-value customer segments
- Understand product and category performance
- Analyze the impact of discounts and promotional offers
- Compare subscribed and non-subscribed customers
- Identify seasonal purchasing trends
- Analyze customer purchase frequency
- Build an interactive business intelligence dashboard
- Generate actionable business recommendations
Dataset: Customer Shopping Behavior Dataset
Size:
- 3,900 records
- 18 columns
| Category | Attributes |
|---|---|
| Customer | Customer ID, Age, Gender, Location |
| Product | Item Purchased, Category, Size, Color, Season |
| Transaction | Purchase Amount, Review Rating |
| Marketing | Discount Applied, Promo Code Used |
| Customer Behavior | Subscription Status, Previous Purchases, Frequency of Purchases |
| Operations | Shipping Type, Payment Method |
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Jupyter Notebook
- PostgreSQL
- SQL
- Microsoft Power BI
- DAX
- Git
- GitHub
Raw Customer Data
β
Data Cleaning & Preprocessing
β
Exploratory Data Analysis
β
Feature Engineering
β
PostgreSQL Database
β
SQL Business Analysis
β
Power BI Dashboard
β
Business Insights & Recommendations
The dataset was loaded into Python using Pandas.
Initial checks were performed to understand:
- Dataset dimensions
- Column names
- Data types
- Missing values
- Duplicate records
- Data consistency
The dataset was prepared for analysis by:
- Checking missing values
- Removing duplicate records
- Standardizing categorical values
- Correcting data types
- Preparing analytical fields
EDA was performed to understand:
- Customer demographics
- Purchase amount distribution
- Product category performance
- Seasonal purchasing behavior
- Customer purchasing frequency
- Subscription behavior
- Discount and promotional impact
The cleaned dataset was loaded into PostgreSQL for structured analytical querying.
The SQL analysis investigates areas such as:
- Revenue by category
- Average purchase amount
- Customer purchasing frequency
- Subscription vs. non-subscription behavior
- Discount impact
- Promotional code usage
- Customer segmentation
An interactive Power BI dashboard was created to provide a business-oriented view of the analysis.
- Total Revenue
- Average Order Value
- Product Category Performance
- Top-Selling Products
- Customer Segments
- Subscription Analysis
- Seasonal Trends
- Demographic Analysis
- Interactive filters and slicers
- Total Customers
- Average Purchase Amount
- Average Review Rating
- Subscription behavior
- Revenue by category
- Sales by category
- Revenue by age group
- Sales by age group
- Customer demographics
- Shipping preferences
The dashboard allows users to dynamically filter the analysis by:
- Subscription Status
- Gender
- Category
- Shipping Type
-
Revenue by Gender: Male customers generated $157,890 in revenue compared with $75,191 from female customers, making male customers the larger revenue-contributing segment in this dataset.
-
Discounted Purchases: 839 purchases received a discount while exceeding the overall average purchase amount, highlighting that discounted transactions were not limited to low-value purchases.
-
Product Ratings: Gloves received the highest average product rating at 3.86, followed by Sandals (3.84), Boots (3.82), Hat (3.80), and Skirt (3.78). Overall, the top-rated products had relatively close average ratings.
-
Shipping Behavior: Customers using Express shipping had a higher average purchase amount ($60.48) than customers using Standard shipping ($58.46), a difference of approximately $2.02 per purchase.
-
Subscription Behavior: Non-subscribers generated substantially more total revenue ($170,436) than subscribers ($62,645). However, non-subscribers also represent a much larger customer population (2,847 vs. 1,053), so the revenue difference should be interpreted alongside customer volume.
-
Customer Loyalty: The dataset is dominated by loyal customers, with 3,116 customers classified as Loyal, compared with 701 Returning and 83 New customers. This indicates a strong concentration of customers with previous purchase activity.
-
Repeat Purchasing: Among repeat buyers, 2,518 were non-subscribers and 958 were subscribers. This suggests that repeat purchasing occurs substantially outside the subscription program.
-
Discounting: Hat had the highest discount rate at 50%, followed by Sneakers and Coat at 49%. Sweater and Pants also had relatively high discount rates of 48% and 47%, respectively.
-
Category-Level Product Demand: Jewelry led the Accessories category with 171 orders, while Blouse and Pants each recorded 171 orders in Clothing. Sandals led Footwear with 160 orders, and Jacket led Outerwear with 163 orders.
-
Revenue by Age Group: Young Adults generated the highest revenue at $62,143, followed by Middle-aged customers ($59,197), Adults ($55,978), and Seniors ($55,763). Revenue was relatively distributed across the age groups, with Young Adults contributing the most.
Based on the analysis, the following actions could be considered:
-
Focus on high-revenue customer segments
Male customers generated the largest share of revenue in this dataset, suggesting an opportunity to understand their product preferences and purchasing behavior more deeply. -
Investigate subscription conversion opportunities
Non-subscribers account for a much larger customer base and generate substantially more total revenue. Analyzing why repeat buyers remain unsubscribed could help identify opportunities for subscription conversion. -
Prioritize high-performing products
Products such as Gloves, Sandals, and Boots achieved the highest average ratings, while several products also showed strong order volumes within their respective categories. These products could receive additional promotional or inventory attention. -
Evaluate discount effectiveness
Products with high discount rates should be evaluated to determine whether discounts are increasing purchase volume sufficiently to justify the reduction in selling price. -
Target younger customer segments
Young Adults generated the highest revenue among the analyzed age groups. Marketing campaigns and product recommendations could be evaluated for stronger engagement with this segment.
Customer_Behavior_Analysis/
β
βββ screenshots/
β βββ dashboard_overview.png
β βββ dashboard_filtered_analysis.png
β
βββ Consumer_Behavior_Analysis.sql
βββ Consumer_Behavior_Dashboard.pbix
βββ Consumer_Shopping_Behavior_Analysis.ipynb
βββ customer_shopping_behavior.csv
βββ Customer Shopping Behavior Analysis.pdf
βββ Customer-Shopping-Behavior-Analysis.pptx
βββ README.md
Clone the repository:
git clone https://github.com/Kruti115/Customer_Behavior_Analysis.gitInstall required Python libraries:
pip install pandas numpy matplotlib seabornOpen the Jupyter Notebook:
Consumer_Shopping_Behavior_Analysis.ipynb
Run the notebook cells sequentially.
- Install PostgreSQL.
- Create a PostgreSQL database.
- Import the cleaned dataset.
- Open
Consumer_Behavior_Analysis.sql. - Execute the queries.
Open:
Consumer_Behavior_Dashboard.pbix
using Power BI Desktop.
- Python EDA notebook
- PostgreSQL SQL analysis
- Interactive Power BI dashboard
- Analytical report
- Project presentation
- Data cleaning and preprocessing
- Exploratory Data Analysis (EDA)
- Feature engineering
- Data visualization
- Pandas and NumPy
- Aggregation and grouping
- Filtering and sorting
- Subqueries
- CASE statements
- Common Table Expressions (CTEs)
- Window functions
- Business-oriented SQL analysis
- Interactive dashboards
- KPI development
- Slicers and filters
- Data visualization
- Business insight presentation
- Jupyter Notebook
- PostgreSQL / pgAdmin 4
- Power BI
- Git & GitHub
Kruti Gupta
GitHub: https://github.com/Kruti115

