Complete the code to split data into two groups for A/B testing.
group_a = data.sample(frac=[1], random_state=42) group_b = data.drop(group_a.index)
Using frac=0.5 splits the data evenly into two groups for A/B testing.
Complete the code to calculate the conversion rate for group A.
conversion_rate_a = group_a['converted'].[1]()
The mean() function calculates the average conversion rate (proportion of converted users).
Fix the error in the code to perform a t-test between groups A and B.
from scipy.stats import ttest_ind stat, p_value = ttest_ind(group_a['converted'], [1]['converted'])
The t-test compares the 'converted' values between group A and group B, so the second argument must be group_b['converted'].
Fill both blanks to calculate the p-value and check if the result is significant at 5%.
stat, p_value = ttest_ind(group_a['converted'], group_b['converted']) is_significant = p_value [1] 0.05
We check if the p-value is less than 0.05 to decide if the difference is statistically significant.
Fill all three blanks to create a summary dictionary with group names, conversion rates, and significance result.
summary = {
'[1]': conversion_rate_a,
'[2]': conversion_rate_b,
'significant_difference': [3]
}The dictionary keys should be descriptive group names and the boolean variable for significance.