0
0
SciPydata~30 mins

Mann-Whitney U test in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Mann-Whitney U Test with SciPy
📖 Scenario: You are a data analyst working with two groups of patients. You want to check if the two groups have different distributions of recovery times without assuming the data follows a normal distribution.
🎯 Goal: Perform the Mann-Whitney U test using SciPy to compare recovery times between two patient groups and interpret the test result.
📋 What You'll Learn
Create two lists of recovery times for two patient groups
Set a significance level variable
Use SciPy's mannwhitneyu function to perform the test
Print the U statistic and p-value
💡 Why This Matters
🌍 Real World
The Mann-Whitney U test is used in medical research, social sciences, and other fields to compare two groups when data is not normally distributed.
💼 Career
Data analysts and scientists use this test to make decisions about differences between groups without relying on assumptions of normality.
Progress0 / 4 steps
1
Create recovery time data for two patient groups
Create two lists called group1 and group2 with these exact recovery times: group1 = [5, 7, 8, 6, 9] and group2 = [10, 12, 9, 11, 13].
SciPy
Need a hint?

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

2
Set the significance level
Create a variable called alpha and set it to 0.05 to represent the significance level for the test.
SciPy
Need a hint?

Use a simple assignment to create the variable alpha.

3
Perform the Mann-Whitney U test
Import mannwhitneyu from scipy.stats and use it to perform the test on group1 and group2. Store the results in variables u_statistic and p_value.
SciPy
Need a hint?

Use alternative='two-sided' to test for difference in either direction.

4
Print the test results
Print the values of u_statistic and p_value using two separate print statements.
SciPy
Need a hint?

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