Exercise

# Calculate granular CLV

In this scenario you will use more granular data points at the invoice level. This approach uses more granular data and can give a better customer lifetime value estimate. Make sure you compare the results with the one from the basic CLV model.

The `pandas`

and `numpy`

libraries have been loaded as `pd`

as `np`

respectively. The `online`

dataset has been imported for you.

Instructions

**100 XP**

- Group by
`InvoiceNo`

and calculate the mean of the`TotalSum`

column. - Group by
`CustomerID`

and`InvoiceMonth`

and calculate the mean number of unique monthly invoices per customer. - Define lifespan to 36 months.
- Calculate the granular CLV by multiplying the three previous metrics.