Case Study [ Customer Analytics]

 


1. Project Overview

In this project, I analyzed an e-commerce dataset to understand customer purchasing behavior, revenue distribution, and customer segments. The goal was to help the business identify high-value customers, at-risk customers, and opportunities for targeted marketing campaigns.

Using customer transaction data, I implemented RFM (Recency, Frequency, Monetary) segmentation to classify customers based on their purchasing patterns.


2. Business Problem

E-commerce companies often struggle to:

  • Identify their most valuable customers
  • Detect customers likely to churn
  • Understand which products drive the most revenue
  • Target marketing campaigns effectively

Without segmentation, marketing campaigns become inefficient and expensive.

This project aims to segment customers based on purchasing behavior and generate actionable business insights.


3. Dataset

The dataset contains three tables merged into a single analytical dataset.

Customers

  • customer_id
  • first_purchase_date
  • last_purchase_date
  • total_orders
  • total_spend

Orders

  • order_id
  • customer_id
  • product_id
  • quantity
  • order_date
  • order_value

Products

  • product_id
  • product_name
  • category
  • cost_price
  • selling_price
  • margin

4. Data Preparation

The following preprocessing steps were performed:

Data Cleaning

  • Converted date columns to datetime
  • Removed duplicates
  • Checked for missing values
  • Standardized pricing fields

Dataset Merging

The three datasets were merged using:

  • customer_id
  • product_id
  • order_id

Resulting in a single transactional dataset.

Example:

df_final= (
df_orders
.merge(df_customers,on="customer_id",how="left")
.merge(df_products,on="product_id",how="left")
)

5. Feature Engineering

Customer-level features were created for segmentation.

Recency

Days since customer's last purchase.

recency=today-last_purchase_date

Frequency

Total number of orders per customer.

frequency=total_orders

Monetary

Total amount spent by each customer.

monetary=total_spend

These three metrics form the RFM model.


6. Customer Segmentation (RFM Model)

Customers were segmented using quantile scoring:

Score Meaning
5 Best
1 Lowest

Segments were then categorized into:

Segment Description
Loyal Customers Frequent buyers with high spend
Potential Loyalists Recently active customers
New Customers Recently acquired
At Risk Previously active but declining
Lost Customers Inactive customers

7. Visualization

Customer segments were visualized using a colorful bar chart to show distribution.

Example insights:

  • Majority of customers fall under Potential Loyalists
  • Smaller group of Loyal Customers drives a large share of revenue
  • Some customers are At Risk and require re-engagement campaigns

8. Key Insights

1. High-value customers

A small percentage of customers generated the largest share of revenue.

2. At-risk customers

Customers who previously purchased frequently but haven't ordered recently represent churn risk.

3. Product-driven revenue

Certain product categories generated significantly higher margins.

4. Repeat purchasing behavior

Customers with more than 5 orders showed significantly higher lifetime value.


9. Business Recommendations

1. Loyalty programs

Offer incentives to loyal customers to retain them.

2. Re-engagement campaigns

Send targeted emails or discounts to at-risk customers.

3. Personalized product recommendations

Use purchase history to recommend relevant products.

4. Focus marketing spend

Prioritize high-value customer segments rather than broad campaigns.


10. Project Impact

This project demonstrates how data analytics can help businesses:

  • Understand customer behavior
  • Improve marketing efficiency
  • Increase revenue through targeted strategies

Comments

Popular posts from this blog

FOR ANYONE WHO THINKS THEY STARTED TOO LATE TO GET INTO DATA: