Timetrends is conducting an A/B test to evaluate the effectiveness of a new watch screen design (B) compared to the existing design (A) in boosting sales and engagement. The dataset includes campaign details such as date, spend, impressions, and user interactions. The null hypothesis (H0) states that the new design does not improve campaign performance, while the alternative hypothesis (H1) suggests the new design outperforms the existing one. As the data detective, your task is to analyze the metrics and determine which watch screen design is more effective in driving sales and engagement, guiding future marketing strategies for the company.
Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
.describe()
method on the DataFrame 'test_df'..describe()
method on the DataFrame 'control_df'..isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Update the column names in the DataFrame 'test_df' to the following list:
Update the column names in the DataFrame 'control_df' to the following list:
Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
.describe()
method on the DataFrame 'control_df'.Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
.describe()
method on the DataFrame 'control_df'.Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
.describe()
method on the DataFrame 'test_df'..isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Update the column names in the DataFrame 'test_df' to the following list:
Update the column names in the DataFrame 'control_df' to the following list:
.describe()
method on the DataFrame 'control_df'.Update the column names in the DataFrame 'test_df' to the following list:
Update the column names in the DataFrame 'control_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
.describe()
method on the DataFrame 'control_df'.Update the column names in the DataFrame 'control_df' to the following list:
Update the column names in the DataFrame 'test_df' to the following list:
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column..describe()
method on the DataFrame 'control_df'..describe()
method on the DataFrame 'test_df'.Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Create a list 'metrics_to_test' containing the metrics: 'ROI','CTR', 'Conversion Rate', 'CPC'.
Initialize an empty list 'results_list' to store the results of the t-tests.
Iterate through each metric in 'metrics_to_test':
Concatenate the DataFrames in 'results_list' into a final DataFrame 't_test_results' using pd.concat()
.
The DataFrame 't_test_results' now contains the results of the independent two-sample t-tests for the specified metrics between the 'Control Campaign' and 'Test Campaign'.
Calculate the Click-Through Rate (CTR):
(Number of Clicks / Impressions) * 100
.Calculate the Conversion Rate:
(Purchase Number / Number of Clicks) * 100
.Calculate the Cost Per Click (CPC):
Amount Spent / Number of Clicks
.Calculate the Return on Investment (ROI):
((Purchase Number - Amount Spent) / Amount Spent) * 100
.The DataFrame 'merged' now includes the calculated metrics for Click-Through Rate (CTR), Conversion Rate, Cost Per Click (CPC), and Return on Investment (ROI).
pd.concat()
function to concatenate the DataFrames 'control_df' and 'test_df'.
[control_df, test_df]
.Create a new column 'Cost per Conversion' in both 'control_df' and 'test_df'.
Calculate the mean of the 'Cost per Conversion' column for 'control_df' and 'test_df'.
The variables 'average_cost_control' and 'average_cost_test' now contain the average cost per conversion for the 'Control' and 'Test' groups, respectively.
Import the 'ttest_ind' function from 'scipy.stats'.
Apply the independent two-sample t-test using 'ttest_ind' on the 'Purchase Number' columns of 'control_df' and 'test_df'.
The variables 't_stat' and 'p_value' now contain the results of the independent two-sample t-test for the 'Purchase Number' between the 'Control' and 'Test' groups.
Import the 'shapiro' function from 'scipy.stats'.
Create an empty DataFrame 'shapiro_results' with columns ['Group', 'Test Statistic', 'P-value'].
Apply the Shapiro-Wilk test on the 'Purchase Number' column of the 'control_df' DataFrame.
Repeat the same process for the 'Purchase Number' column of the 'test_df' DataFrame.
The 'shapiro_results' DataFrame will contain the results of the Shapiro-Wilk test for normality on the 'Purchase Number' column for both the 'Control' and 'Test' groups.
.describe()
method on the DataFrame 'test_df'..describe()
method on the DataFrame 'control_df'..isnull()
method on the DataFrame 'test_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Use the.fillna()
method on the 'Reach' column of the DataFrame 'control_df'.
Repeat the same process for the following columns:
After executing these operations, the specified columns in the DataFrame 'control_df' will have null values filled with their respective means.
.isnull()
method on the DataFrame 'control_df' to create a DataFrame of Boolean values, where True indicates a null value and False indicates a non-null value..sum()
method on the resulting DataFrame to calculate the sum of null values for each column.Update the column names in the DataFrame 'test_df' to the following list:
Update the column names in the DataFrame 'control_df' to the following list: