Customer segmentation is a method of dividing customers into groups or clusters on the basis of common characteristics.
The market researcher can segment customers into the B2C model using various customer’s demographic characteristics such as occupation, gender, age, location, and marital status.
Psychographic characteristics such as social class, lifestyle and personality characteristics and behavioral characteristics such as spending, consumption habits, product/service usage, and previously purchased products.
In the B2B model using various company’s characteristics such as the size of the company, type of industry, and location.
In the Retail sector, the various chain of hypermarkets generating an exceptionally large amount of data. This data is generated on a daily basis across the stores.
This extensive database of customers transactions needs to analyze for designing profitable strategies.
All customers have different-different kind of needs. With the increase in customer base and transaction, it is not easy to understand the requirement of each customer.
Segmentation can play a better role in grouping those customers into various segments:
It helps in identifying the most potential customers.
It helps managers to easily communicate with a targetted group of the audience.
It helps in selecting the best medium for communicating with the targetted segment.
It improves the quality of service, loyalty, and retention.
It improves customer relationship via better understanding needs of segments.
It provides opportunities for upselling and cross-selling.
It helps managers to design special offers for targetted customers, to encourage them to buy more products.
It helps companies to stay a step ahead of competitors.
It also helps in identifying new products that customers could be interested in.
RFM (Recency, Frequency, Monetary) analysis is a behavior-based approach grouping customers into segments.
It groups the customers on the basis of their previous purchase transactions. How recently, how often, and how much did a customer buy.
RFM filters customers into various groups for the purpose of better service.
Recency (R): Who have purchased recently? Number of days since last purchase (least recency).
Frequency (F): Who has purchased frequently? It means the total number of purchases. ( high frequency).
Monetary Value(M): Who have high purchase amount? It means the total money customer spent (high monetary value).
Steps of RFM(Recency, Frequency, Monetary):
Calculate the Recency, Frequency, Monetary values for each customer.
Add segment bin values to RFM table using quartile.
# Getting summary statistics for the UKuk_data.describe()
Quantity
UnitPrice
CustomerID
count
361878.000000
361878.000000
361878.000000
mean
11.077029
3.256007
15547.871368
std
263.129266
70.654731
1594.402590
min
-80995.000000
0.000000
12346.000000
25%
2.000000
1.250000
14194.000000
50%
4.000000
1.950000
15514.000000
75%
12.000000
3.750000
16931.000000
max
80995.000000
38970.000000
18287.000000
# Some of the customers have ordered in a negative quantity# Which is not possible# Filter Quantity greater than zero# Filtering quantity greater than zerouk_data=uk_data[(uk_data['Quantity']>0)]uk_data.info()
# Filtering the required columns# for RFM analysis# InvoiceNo helps you to count the number of time transaction# performed(frequency)# Quantity purchased in each transaction and# UnitPrice of each unit purchased by the customer# helps calculating the total purchased amountuk_data=uk_data[['CustomerID','InvoiceDate','InvoiceNo','Quantity','UnitPrice']]uk_data['TotalPrice']=uk_data['Quantity']* \
uk_data['UnitPrice']# InvoiceDate help you calculate recency of purchaseuk_data['InvoiceDate'].min(),uk_data['InvoiceDate'].max()
# Creating a constantPRESENT=dt.datetime(2011,12,10)# InvoiceDate help you calculate recency of purchaseuk_data['InvoiceDate']=pd.to_datetime(uk_data['InvoiceDate'])
Customers with the lowest recency, highest frequency and monetary amounts considered as top customers.
qcut isquantile-based discretization function. qcut bins the data based on sample quantiles.
For example, 1000 values for 4 quantiles would produce a categorical object indicating quantile membership for each customer.