Calculate basic CLV
You are now ready to calculate average customer lifetime with three different methods! In this exercise you will calculate the basic CLV which multiplies average monthly spent with the projected customer lifespan.
The pandas and numpy libraries have been loaded as pd as np respectively. The online dataset has been imported for you.
Deze oefening maakt deel uit van de cursus
Machine Learning for Marketing in Python
Oefeninstructies
- Group by
CustomerIDand calculate monthly spend per customer. - Calculate average monthly spend.
- Define lifespan to 36 months.
- Calculate basic CLV by multiplying monthly average spend with the lifespan.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Calculate monthly spend per customer
monthly_revenue = online.___(['___','InvoiceMonth'])['TotalSum'].___()
# Calculate average monthly spend
monthly_revenue = np.___(monthly_revenue)
# Define lifespan to 36 months
lifespan_months = ___
# Calculate basic CLV
clv_basic = ___ * lifespan_months
# Print the basic CLV value
print('Average basic CLV is {:.1f} USD'.format(clv_basic))