Back to Projects

Customer Segmentation & RFM Analysis

Advanced customer segmentation using RFM analysis to drive targeted marketing strategies

4,000+
Customers Analyzed
2,308
New/Casual Customers
1,319
Champions
448
Loyal Customers
264
At-Risk Customers

Data Preparation & Cleaning

Task: Loaded Excel dataset with standard data libraries and removed rows with missing CustomerID while filtering out non-positive quantities.
Result: Clean sales-only dataframe with line-level revenue column (Total_amount) ready for analysis.
Data Cleaning Code
Data cleaning and preparation code
Cleaned Dataset
Cleaned customer dataset preview

RFM Metrics Calculation

Task: Grouped by CustomerID to compute Recency (days since last purchase), Frequency (unique InvoiceNo count), and Monetary (sum of Total_amount).
Result: Comprehensive rfm_df with columns CustomerID, Recency, Frequency, Monetary for 4,000+ customers.
RFM Calculation Code
RFM metrics calculation implementation

RFM Scoring System

Task: Binned Recency, Frequency, and Monetary values into 1–4 scores using qcut and ranked qcut methods.
Result: Created R_score, F_score, M_score as integers with Total_score (sum) computed for comprehensive customer ranking.
RFM Scoring Code
RFM scoring algorithm implementation

Customer Segmentation

Champions

1,319 Customers
Recent, frequent, high-value customers - your brand advocates

Loyal Customers

448 Customers
Regular customers who respond well to promotions

At Risk

264 Customers
High-value customers showing signs of inactivity

New/Casual

2,308 Customers
Recent customers with high conversion potential
Segmentation Code
Customer segmentation logic
Segmentation Chart
Customer segment distribution visualization

Customer Lifetime Value Analysis

Task: Calculated average customer lifetime value (mean Monetary) and extracted top customers by Monetary value.
Result: Computed average CLV and identified Top-10 customers by spend for targeted CRM follow-up and retention strategies.
CLV Calculation Code
Customer lifetime value calculation
Top Customers
Top 10 customers by spending

Segment Analysis & Distributions

Task: Aggregated segment-level KPIs (count, mean Recency, Frequency, Monetary) and plotted histograms for Recency, Frequency, Monetary distributions.
Result: Comprehensive segment analysis table and three distribution charts for stakeholder review and strategic planning.
Segment Analysis Code
Segment-level analysis implementation
Segment KPIs
Segment performance metrics dashboard