Identifying and understanding KPIs

Customer Analytics and A/B Testing in Python

Ryan Grossman

Data Scientist, EDO

Example: meditation app

Services

  • Paid subscription
  • In-app purchases

Goals/KPIs

  • Maintain high free → paid conversion rate
Customer Analytics and A/B Testing in Python

Dataset 1: User demographics

import pandas as pd

# load customer_demographics customer_demographics = pd.read_csv('customer_demographics.csv')
# print the head of customer_demographics print(customer_demographics.head())
uid         reg_date    device    gender    country      age
54030035    2017-06-29    and        M        USA        19
72574201    2018-03-05    iOS        F        TUR        22
64187558    2016-02-07    iOS        M        USA        16
92513925    2017-05-25    and        M        BRA        41
99231338    2017-03-26    iOS        M        FRA        59
Customer Analytics and A/B Testing in Python

Dataset 2: User actions

# load customer_subscriptions
customer_subscriptions = pd.read_csv('customer_subscriptions.csv')

# print the head of customer_subscriptions print(customer_subscriptions.head())
uid         lapse_date     subscription_date      price
59435065    2017-07-06     2017-07-08             499
26485969    2018-03-12     None                   0
64187658    2016-02-14     2016-02-14             499
99231339    2017-04-02     None                   0
64229717    2017-05-24     2017-05-25             499
Customer Analytics and A/B Testing in Python

KPI: Conversion Rate

  • Conversion Rate: Percentage of users who subscribe after the free trial
    • Of users who convert within one week? One month?...
    • Across all users or just a subset?
    • ...

Choosing a KPI

  • Stability over time
  • Importance across different user groups
  • Correlation with other business factors
Customer Analytics and A/B Testing in Python

Joining the demographic and subscription data

  • Merging — equivalent of SQL JOIN
  • In pandas:
    • pd.merge(df1, df2)
    • df1.merge(df2)

Customer Analytics and A/B Testing in Python

Merging mechanics

# merge customer_demographics (left) and customer_subscriptions (right)
sub_data_demo = customer_demographics.merge(

# right dataframe customer_subscriptions,
# join type how='inner',
# columns to match on=['uid'])
sub_data_demo.head()
uid         reg_date        device  ...price 
54030729    2017-06-29      and     ...499
Customer Analytics and A/B Testing in Python

Next steps

  • Aggregate combined dataset
  • Calculate the potential KPIs

Customer Analytics and A/B Testing in Python

Let's practice!

Customer Analytics and A/B Testing in Python

Preparing Video For Download...