Customer Segmentation in Online Retail | by Rahul Khandelwal | Jan, 2021

[ad_1]


RFM stands for Recency, Frequency, and Monetary. RFM analysis is a commonly used technique to generate and assign a score to each customer based on how recent their last transaction was (Recency), how many transactions they have made in the last year (Frequency), and what the monetary value of their transaction was (Monetary).

Photo by Austin Distel on Unsplash
Fig: .describe() method on TotalSum column
# Aggregate data on a customer level
data = data_rfm.groupby(['CustomerID'],as_index=False).agg({
'InvoiceDate': lambda x: (snapshot_date - x.max()).days,
'InvoiceNo': 'count',
'TotalSum': 'sum'}).rename(columns = {'InvoiceDate': 'Recency', 'InvoiceNo': 'Frequency','TotalSum': 'MonetaryValue'})
Fig: RFM scores and quartiles.
Fig: mean values of recency, frequency, and monetary for different RFM score values
Fig: mean values of recency, frequency, and monetary for different categories

Read More …

[ad_2]


Write a comment