본문으로 건너뛰기
Workshop overview
Chapter 3 of 7
15 min

Turn three customer questions into segments

Ask when, how often, and how much a customer bought before learning the RFM acronym and label rules.

Question for this chapter

Which three questions help choose a customer's next action?

Why this matters now

The questions are easier to understand than the acronym:

  1. How recently did they buy? — days since the latest order
  2. How frequently did they buy? — distinct order count
  3. How much did they spend? — total purchase value

Their initials form Recency, Frequency, and Monetary value: RFM.

Try it

Open the customer_segmentation pipeline under analytics and select Run. It runs two steps:

  1. join_datasets — inner-join cleaned orders with customers on customer_id
  2. rfm_segmentation — aggregate the last order, order count, and spend, then assign a label

The current code uses one day after the latest order in the data as its reference date.

ConditionSegmentPlain-language reading
Within 30 days, 5 or more orderschampionBought often and recently
Within 30 days, 2–4 ordersloyalRepeated recent purchases
More than 30 days, 2 or more ordersat_riskBought repeatedly, then went quiet
Everything elsenewUsually a one-time customer

Spend remains in total_spend and avg_order_value as campaign context, but the current label branch itself uses recency and order count.

Success looks like this

customer_analytics contains 22 rows with total_orders, total_spend, avg_order_value, last_order_date, and segment populated.

Next decision

You understand the rules. Next, count how the 22 customers actually distribute across the four labels and identify the group that does not exist.