CommencerCommencer gratuitement

Calculate traditional CLV

Now you will calculate one of the most popular descriptive CLV models that accounts for the retention and churn rates. This gives a more robust estimate, but comes with certain assumptions that have to be validated. Make sure you review the video slides before you apply this method to your own use case.

The pandas and numpy libraries have been loaded as pd as np respectively. The online and retention datasets have been imported for you.

Cet exercice fait partie du cours

Machine Learning for Marketing in Python

Afficher le cours

Instructions

  • Group by CustomerID and InvoiceMonth and calculate monthly spend per customer.
  • Calculate average monthly retention rate.
  • Calculate average monthly churn rate.
  • Calculate traditional CLV by multiplying monthly average spend with retention to churn ratio.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Calculate monthly spend per customer
monthly_revenue = online.___(['CustomerID','InvoiceMonth'])['___'].sum().mean()

# Calculate average monthly retention rate
retention_rate = retention.iloc[:,1:].mean().mean()

# Calculate average monthly churn rate
churn_rate = 1 - ___

# Calculate traditional CLV 
clv_traditional = monthly_revenue * (___ / churn_rate)

# Print traditional CLV and the retention rate values
print('Average traditional CLV is {:.1f} USD at {:.1f} % retention_rate'.format(clv_traditional, retention_rate*100))
Modifier et exécuter le code