Session Ready
Exercise

Calculate 3 groups for recency and frequency

You will now group the customers into three separate groups based on Recency, and Frequency.

The dataset has been loaded as datamart, you can use console to view top rows of it. Also, pandas has been loaded as pd.

We will use the result from the exercise in the next one, where you will group customers based on the MonetaryValue and finally calculate and RFM_Score.

Once completed, print the results to the screen to make sure you have successfully created the quartile columns.

Instructions
100 XP
  • Create labels for Recency with a decreasing range of 3 through 1, and labels for Frequency with an increasing range of 1 through 3.
  • Assign these labels to three equal percentile groups based on Recency.
  • Assign these labels to three equal percentile groups based on Frequency.
  • Create new quantile columns R and F.