Average purchase price by cohort
Building on the previous exercise, let's look at the same KPI, average purchase price, and a similar one, median purchase price, within the first 28 days. Additionally, let's look at these metrics not limited to 28 days to compare.
We can calculate these metrics across a set of cohorts and see what differences emerge. This is a useful task as it can help us understand how behaviors vary across cohorts.
Note that in our data the price variable is given in cents.
Bu egzersiz
Customer Analytics and A/B Testing in Python
kursunun bir parçasıdırUygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Set the max registration date to be one month before today
max_reg_date = current_date - timedelta(days=28)
# Find the month 1 values:
month1 = np.where((purchase_data.____ < ____) &
(____ < ____ + timedelta(days=28)),
purchase_data.____,
np.NaN)
# Update the value in the DataFrame
purchase_data['month1'] = month1