BaşlayınÜcretsiz Başlayın

Calculate relative importance of each attribute

Now you will calculate the relative importance of the RFM values within each cluster.

We have loaded datamart_rfm with raw RFM values, and datamart_rfm_k3 which has raw RFM values and the cluster labels stored as Cluster. The pandas library is also loaded as pd.

Feel free to explore the datasets in the console.

Bu egzersiz

Customer Segmentation in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Calculate average RFM values for each cluster - use datamart_rfm_k3 dataset.
  • Calculate average RFM values for the total customer population - use datamart_rfm dataset.
  • Calculate relative importance of cluster's attribute value compared to population.
  • Print relative importance scores rounded to 2 decimals.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Calculate average RFM values for each cluster
cluster_avg = ____.groupby(['____']).____() 

# Calculate average RFM values for the total customer population
population_avg = ____.____()

# Calculate relative importance of cluster's attribute value compared to population
relative_imp = ____ / ____ - ____

# Print relative importance scores rounded to 2 decimals
print(relative_imp.____(____))
Kodu Düzenle ve Çalıştır