Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Plotting Boxplots | Normality Check
The Art of A/B Testing

book
Challenge: Plotting Boxplots

Завдання

Swipe to start coding

In this task, you need to draw box plots of the 'Click' columns for the control and test samples. Box plots are very informative graphs and are constantly used for visual analysis of data distribution.

  1. Import libraries.
  2. Read the files.
  3. Plot the boxplots.

Рішення

# Import libraries
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Read .csv files
df_control = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_control.csv', delimiter=';')
df_test = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_test.csv', delimiter=';')

# We add to the dataframes columns-labels, which mean belonging to either the control or the test group
df_control['group'] = 'Contol group'
df_test['group'] = 'Test group'

# Concat the dataframes and plotting boxplots
df_combined = pd.concat([df_control, df_test])
sns.boxplot(data=df_combined, x='group', y='Click', palette=['#1e2635', '#ff8a00'],
medianprops={'color': 'red'})
# Sign the axes
plt.xlabel('')
plt.ylabel('Clicks')
plt.title('Comparison of Clicks')

# Show the results
plt.show()

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 6
# Import libraries
import ___ as pd
import ___ as plt
import ___ as sns

# Read .csv files
df_control = pd.___('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_control.csv', delimiter=';')
df_test = pd.___('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_test.csv', delimiter=';')

# We add to the dataframes columns-labels, which mean belonging to either the control or the test group
df_control['group'] = 'Contol group'
df_test['group'] = 'Test group'

# Concat the dataframes and plotting boxplots
df_combined = pd.concat([df_control, df_test])
sns___(data=___, x='group', y='Click', palette=['#1e2635', '#ff8a00'],
medianprops={'color': 'red'})

# Sign the axes
plt.xlabel('')
plt.ylabel('Clicks')
plt.title('Comparison of Clicks')

# Show the results
plt.show()
toggle bottom row
some-alt