Analyzing RFM segments

Customer Segmentation in Python

Karolis Urbonas

Head of Data Science, Amazon

Largest RFM segments

datamart.groupby('RFM_Segment').size().sort_values(ascending=False)[:10]

top_rfm_segments

Customer Segmentation in Python

Filtering on RFM segments

  • Select bottom RFM segment "111" and view top 5 rows
datamart[datamart['RFM_Segment']=='111'][:5]

top-111-segments

Customer Segmentation in Python

Summary metrics per RFM score

datamart.groupby('RFM_Score').agg({
    'Recency': 'mean',
    'Frequency': 'mean',
    'MonetaryValue': ['mean', 'count'] })/
    .round(1)

Customer Segmentation in Python

Grouping into named segments

Use RFM score to group customers into Gold, Silver and Bronze segments.

def segment_me(df):
    if df['RFM_Score'] >= 9:
        return 'Gold'
    elif (df['RFM_Score'] >= 5) and (df['RFM_Score'] < 9):
        return 'Silver'
    else:
        return 'Bronze'

datamart['General_Segment'] = datamart.apply(segment_me, axis=1)
datamart.groupby('General_Segment').agg({ 'Recency': 'mean', 'Frequency': 'mean', 'MonetaryValue': ['mean', 'count']}).round(1)
Customer Segmentation in Python

New segments and their values

Customer Segmentation in Python

Practice building custom segments

Customer Segmentation in Python

Preparing Video For Download...