1. Learn
  2. /
  3. Courses
  4. /
  5. Performing Experiments in Python

Exercise

Chi-square test

In this exercise, you will be working with the Olympics dataset. Here, we're going to look at the sex ratio of the American Olympic squads. Is a bias present? That is to say, does the ratio of male to female athletes significantly depart from 50-50? To test this, you'll need to perform a Chi-square test on the Sex data. Data on American athletes is provided as athletes. pandas, and plotnine have been loaded into the workspace as pd and p9.

Instructions

100 XP
  • Using value_counts(), extract the number of individuals of each Sex from athletes, saving the result as sexratio.
  • Perform a chisquare() test on sexratio and print the result.
  • Compare the p-value to the given alpha and print the message.