Get startedGet started for free

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.

This exercise is part of the course

Machine Learning for Marketing in Python

View Course

Exercise 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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))
Edit and Run Code