text_plain_output_1.png
import pandas as pd

path = '../input/mobile-games-ab-testing/cookie_cats.csv'
df = pd.read_csv(path)

df.shape

df.userid = df.userid.astype(str)

df.userid.dtypes

df.version.unique()

treatment = df[df['version'] == 'gate_40']

control = df[df['version'] == 'gate_30']

treatment.shape[0]

control.shape[0]

contr_d1 = '{0:.2f}%'.format(control.retention_1.mean() * 100)
trtm_d1 = '{0:.2f}%'.format(treatment.retention_1.mean() * 100)

contr_d7 = '{0:.2f}%'.format(control.retention_7.mean() * 100)
trtm_d7 = '{0:.2f}%'.format(treatment.retention_7.mean() * 100)

retention_1_30 = control.retention_1.mean()
retention_1_40 = treatment.retention_1.mean()
obs_diff_1 = retention_1_40 - retention_1_30

retention_7_30 = control.retention_7.mean()
retention_7_40 = treatment.retention_7.mean()
obs_diff_7 = retention_7_40 - retention_7_30
print('Day 7 Retention rate in the control group is {}'.format(retention_7_30))
print('Day 7 Retention rate in the treatment group is {}'.format(retention_7_40))
print("The difference between control group's Day 7 Retention rate and treatment group's Day 7 retention is {}".format(obs_diff_7))