Task 2 | Customer Segmentation Using RFM Analysis
Welcome to the Customer Segmentation Using RFM Analysis Project! This project focuses on analyzing customer purchasing behavior through the RFM (Recency, Frequency, Monetary) model, uncovering patterns that help businesses understand their customers better. By segmenting customers based on their buying habits, we aim to empower decision-makers with actionable insights for personalized marketing strategies and customer retention.
Project Snapshot:
Retail and e-commerce businesses generate massive amounts of transaction data daily . Analyzing this data with RFM provides powerful insights into who your best customers are, who needs attention, and who may be slipping away. In this project, we focused on:
- Measuring Recency, Frequency, and Monetary value for each customer
- Assigning RFM scores to categorize customers
- Creating customer segments (Champions, Loyal, At Risk, Hibernating, etc.)
- Building multiple visualizations (heatmaps, scatter plots, bar charts, etc.)
- Suggesting targeted marketing strategies for each segment This project transforms raw sales transactions into a customer-centric view of business, enabling smarter decisions and long-term growth.
Objectives
- Clean and preprocess the sales dataset for accurate analysis
- Calculate RFM metrics for each customer
- Assign RFM scores and create meaningful segments
- Build visualizations to showcase patterns & clusters
- Highlight customer behavior insights (best vs. risk customers)
- Recommend marketing actions tailored to each segment
Tools & Technologies Used
- Language: Python
- Libraries: Pandas, NumPy, Seaborn, Matplotlib, Datetime
- Analysis Methods: Descriptive Analysis | RFM Segmentation | Customer Analytics
- Visualizations: Heatmaps | Line Charts | Bar Charts | Scatter Plots | Boxplots | Histograms | KPI-style summaries
Dataset Details:
The dataset contains transaction-level records of an online retail store, with the following key fields:
- Invoice Date - Date of purchase
- Invoice Number - Transaction ID
- Customer ID - Unique customer identifier
- Quantity & Unit Price - Purchase details
- Total Sales - Derived from Quantity x Price
Workflow & Approach:
1 Data Preparation & Cleaning
- Imported the dataset into Python (Pandas)
- Removed missing values & cancelled invoices
- Created new fields (e.g., TotalPrice)
2 RFM Feature Engineering
- Recency - Days since last purchase
- Frequency - Number of purchases made
- Monetary - Total spending of each customer
3 Scoring & Segmentation
Assigned R, F, M scores (1-5) using quantiles Created a combined RFM Score (e.g., 555 = best customer) Classified customers into segments such as:
- Champions
- Loyal Customers
- Potential Loyalists
At Risk - Hibernating
4 Visualization & Analysis
- Created 10+ different visualizations, including:
- Recency, Frequency, Monetary Distributions
- RFM Correlation Heatmap
- Segment-Wise Customer Count
- Avg. Monetary Value per Segment
- Scatter Plots (Recency vs Frequency, Monetary vs Frequency)
- Boxplots of Monetary by Segment
- Line Chart of Avg. RFM values per Segment
5 Insights & Strategy
Some key findings include:
- Champions are the most valuable customers - Reward with loyalty programs & VIP offers
- Loyal Customers shop frequently - Upsell & cross-sell relevant products
- Potential Loyalists need nurturing - Send personalized promotions
- At Risk Customers are slipping - Win-back campaigns with discounts
- Hibernating Customers are inactive - Re-engage via awareness campaigns
Deliverables:
- Cleaned Dataset - RFM_Cleaned.csv
- Python Notebook - RFM_Analysis.ipynb
- Segmentation Report - Customer_Segmentation_Report.docx / PDF
- Visualizations - Heatmaps, Charts, and Segment Analysis
Conclusion:
This project demonstrates how RFM Analysis transforms raw retail data into customer-focused insights. By applying segmentation techniques and visualizing patterns, we can identify top customers, prevent churn, and design smarter marketing strategies. The result is a data-driven customer segmentation framework that helps businesses build stronger relationships, improve engagement, and maximize profitability.