> ## Content Index
> Fetch the complete content index at: https://www.aveshneeiyer.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# RFM for Customer Segmentation and Value
- URL: https://www.aveshneeiyer.com/rfm-customer-segmentation/
- Published: 2021-07-28T18:15:05.000Z
- Updated: 2026-07-17T10:21:33.000Z
- Author: Aveshnee iyer

## RFM Segmentation enables you to focus on specific clusters of customers to generate higher response rates. 

### **RFM is a method used for analysing customer value and for customer segmentation. It is commonly used in database marketing and direct marketing.**

**Recency (R):** Days since last purchase.

**Frequency (F):** Total number of purchases.

**Monetary Value (M):** Total money spent by customer.

### I have used the online\_retail dataset for a UK online retailer to get to the Top 10 Customers using RFM.

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--7-.png)

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--46-.png)

### **Exploratory Data Analysis**

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--45-.png)

Remove duplicates and group by Country:

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--12-.png)

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--15-.png)

Drill down on the United Kingdom as a country:

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--18-.png)

Customer ID has missing values = 106,429; however the Customer ID column is not relevant for this customer segmentation model Description has missing values however stock is not being analysed for this customer segmentation model.

Checking minimum values in the Quantity column.

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--20-.png)

The dataset has 474,938 rows of data with 8 columns.

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--21-.png)

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--23-.png)

### **Customer Segmentation**

Create a RFM Table:

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--30-.png)

RFM Metrics per customer:

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--28-.png)

*Customer ID 12748:*

- has a Frequency:2634; Monetary value:$22,879.66; Recency:365 days.

*Customer ID 12746:*

- has Frequency:17; Monetary value:$254.55; Recency:540 days.

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--32-.png)

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--33-.png)

### **Definition of best customers** 

### **\= lowest recency, highest frequency, high monetary values**

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--35-.png)

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--37-.png)

Display Segment splits:

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--39-.png)

### **Top 10 Customers using RFM:**

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--41-.png)

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/2021-07-28--42-.png)

### **RFM SEGMENTATION**

![](https://storage.ghost.io/c/63/8c/638cc33b-5912-48b9-958c-94664f8e958a/content/images/2021/07/slide-16-1024.jpg)

Keeping in mind that the **RFM** model only looks at 3 specific factors & excludes products purchased, prior campaign responses, demographic details.

For more Follow me on Medium [https://medium.com/@aveshnee7](https://medium.com/@aveshnee7?ref=aveshneeiyer.com)