Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Now We Can Answer | The First A/B Test
A/B Testing in Python

book
Now We Can Answer

This chapter will help us to answer the question 'Can we believe that the variant of the site will help us to increase in clicks?'

So, we have studied how do 2 groups' distributions look like:

  • Their plots don't look similar;

  • Their confidence intervals don' cover each other a lot.

Earlier, we decided that we were going to use t-criterion criterion to cope with our problem. It is our last check to prove whether there is a NON-RANDOM difference between groups.

To perform the t-test use scipy.stats.ttest_ind(control_group_data, test_group_data).

Task

Swipe to start coding

  1. Perform the t-test.

Solution

# Importing the pandas
import pandas as pd
# Importing the seaborn
import seaborn as sns
# Importing the scipy
import scipy

# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/ae14b913-9d96-48cb-ace7-a332315f7cf4/ab+test+1.csv')
# Control group
df_control = df.query('group == "control" ')
# Test group
df_test = df.query('group == "test" ')

# Perform the t-test
print(scipy.stats.ttest_ind(df_control.clicks, df_test.clicks))

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 7
single

single

# Importing the pandas
import pandas as pd
# Importing the seaborn
import seaborn as sns
# Importing the scipy
import scipy

# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/ae14b913-9d96-48cb-ace7-a332315f7cf4/ab+test+1.csv')
# Control group
df_control = df.query('group == "control" ')
# Test group
df_test = df.query('group == "test" ')

# Perform the t-test
print(___.stats.___(df_control.___, ___))

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

We use cookies to make your experience better!
some-alt