Aan de slagGa gratis aan de slag

Analyzing custom segments

As a final step, you will analyze average values of Recency, Frequency and MonetaryValue for the custom segments you've created.

We have loaded the datamart dataset with the segment values you have calculated in the previous exercise. Feel free to explore it in the console. pandas library is also loaded as pd.

Deze oefening maakt deel uit van de cursus

Customer Segmentation in Python

Cursus bekijken

Oefeninstructies

  • Calculate the averages for Recency, Frequency and MonetaryValue for each RFM_Level segment.
  • As the last column, return the size of each segment passing count to the MonetaryValue column next to the mean.
  • Print the aggregated dataset.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Calculate average values for each RFM_Level, and return a size of each segment 
rfm_level_agg = datamart.____('____').____({
    '____': '____',
    '____': '____',
  
  	# Return the size of each segment
    '____': ['____', '____']
}).round(1)

# Print the aggregated dataset
print(____)
Code bewerken en uitvoeren