<jupyter_start><jupyter_text>Question 85 - Testing user conversionGiven the following [data set](https://docs.google.com/spreadsheets/d/1WnKwSW--x835Uokeq6xInuHg3xxdOyoKcuVfFVcV870/editgid=1401812744), can you see if there's a significant difference between the conversion rate of users between the test and control group? The relevant columns in the table are conversion and test. The conversion column has values of 0 and 1 which represent if the user converted (1) or not (0). The test table has values of 0 and 1 as well, 0 for the control group and 1 for the test group.The solution for premium users will written using Python Pandas.<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

df = pd.read_csv('q085_data.csv')
df.head()
group_conv = dict(df.groupby('test').apply(lambda s: s['conversion'].sum() / len(s)))
conv0, conv1 = group_conv[0], group_conv[1]
print(conv0, conv1)
from statsmodels.stats.weightstats import ztest

ztest(
    df[df['test']==0]['conversion'], 
    x2=df[df['test']==1]['conversion'],
    value=0,
    alternative='two-sided'
)

# https://towardsdatascience.com/hypothesis-testing-in-machine-learning-using-python-a0dc89e169ce
# https://towardsdatascience.com/spotting-conversion-rate-drop-with-two-sample-hypothesis-testing-using-e-commerce-monitoring-24542ada6122<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup