0
0
Data Analysis Pythondata~30 mins

t-test with scipy.stats in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Performing a t-test with scipy.stats
📖 Scenario: You are a data analyst working with two groups of students. You want to check if their test scores are different on average.
🎯 Goal: Build a small program to perform a t-test using scipy.stats to compare two groups of scores.
📋 What You'll Learn
Create two lists of test scores named group1_scores and group2_scores with exact values
Import the ttest_ind function from scipy.stats
Use ttest_ind to calculate the t-test statistic and p-value
Print the t-test statistic and p-value
💡 Why This Matters
🌍 Real World
T-tests are used in many fields like education, medicine, and business to compare two groups and see if they differ in some measurement.
💼 Career
Data analysts and scientists use t-tests to support decisions by testing hypotheses about group differences.
Progress0 / 4 steps
1
Create two lists of test scores
Create a list called group1_scores with these exact values: 85, 90, 78, 92, 88. Also create a list called group2_scores with these exact values: 80, 85, 79, 88, 84.
Data Analysis Python
Hint

Use square brackets [] to create lists and separate numbers with commas.

2
Import the ttest_ind function
Import the function ttest_ind from the module scipy.stats.
Data Analysis Python
Hint

Use the syntax from scipy.stats import ttest_ind.

3
Calculate the t-test statistic and p-value
Use the function ttest_ind with group1_scores and group2_scores as arguments. Save the result in a variable called t_statistic and p_value by unpacking the returned tuple.
Data Analysis Python
Hint

Call ttest_ind(group1_scores, group2_scores) and unpack the result into t_statistic and p_value.

4
Print the t-test results
Print the values of t_statistic and p_value using two separate print statements.
Data Analysis Python
Hint

Use print(t_statistic) and print(p_value) to show the results.