# Import libraries
import matplotlib.pyplot as plt
import pandas as pd
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=';')
# Define the metric
df_test['Average Earnings per Click'] = df_test['Earning'] / df_test['Click']
df_control['Average Earnings per Click'] = df_control['Earning'] / df_control['Click']
# 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='Average Earnings per Click', palette=['#1e2635', '#ff8a00'],
medianprops={'color': 'red'})
# Sign the axis
plt.xlabel('')
plt.ylabel('Average Earnings per Click')
plt.title('Comparison of AEC')
# Show the results
plt.show()