Skip to main content

Hypothesis Testing in Python

Learn how and when to use common hypothesis tests like t-tests, proportion tests, and chi-square tests in Python.

Start Course for Free
4 Hours15 Videos50 Exercises3750 XP

Create Your Free Account



By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).

Loved by learners at thousands of companies

Course Description

Hypothesis testing lets you answer questions about your datasets in a statistically rigorous way. In this course, you'll grow your Python analytical skills as you learn how and when to use common tests like t-tests, proportion tests, and chi-square tests. Working with real-world data, including Stack Overflow user feedback, you'll gain a deep understanding of how these tests work, and the key assumptions that underpin them. You'll also discover how different tests are related using the “there is only one test" framework, before learning how to use non-parametric tests to go beyond the limitations of side-step the requirements of hypothesis tests.

  1. 1

    Yum, That Dish Tests Good


    How does hypothesis testing work and what problems can it solve? To find out, you’ll walk through the workflow for a one sample proportion test. In doing so, you'll encounter important concepts like z-scores, p-values, and false negative and false positive errors.

    Play Chapter Now
    To the lab for testing
    50 xp
    Uses of A/B testing
    50 xp
    Calculating the sample mean
    100 xp
    Calculating a z-score
    100 xp
    A tail of two z's
    50 xp
    Criminal trials and hypothesis tests
    50 xp
    Left tail, right tail, two tails
    100 xp
    Calculating p-values
    100 xp
    Statistically significant other
    50 xp
    Decisions from p-values
    50 xp
    Calculating a confidence interval
    100 xp
    Type I and type II errors
    100 xp
  2. 3

    Letting the Categoricals Out of the Bag

    Now it’s time to test for differences in proportions between two groups using proportion tests. Through hands-on exercises, you’ll extend your proportion tests to more than two groups with chi-square independence tests, and return to the one sample case with chi-square goodness of fit tests.

    Play Chapter Now
  3. 4

    Time to Define the Relationship

    Finally, it’s time to learn about the assumptions made by parametric hypothesis tests, and see how non-parametric tests can be used when those assumptions aren't met.

    Play Chapter Now


Late ShipmentsStack OverflowU.S. Democrat Votes 2012/2016U.S. Republican Votes 2008/2012


chesterismayDr. Chester Ismayamy-4121b590-cc52-442a-9779-03eb58089e08Amy Petersonizzyweber-9bc35945-95bd-423b-833e-40780c76586fIzzy Weber


Sampling in Python
James Chapman Headshot

James Chapman

Content Developer, DataCamp

James is a Content Developer at DataCamp. He has a Master's degree in Physics and Astronomy from Durham University, where he specialized in quasar detection and tutored Math and English. He joined DataCamp as a learner in 2018, and the data skills learned on DataCamp were quickly integrated into his scientific projects. In his spare time, he enjoys restoring retro toys and electronics.

Follow James on LinkedIn
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA