Sampling in Python
Learn to draw conclusions from limited data using Python and statistics. This course covers everything from random sampling to stratified and cluster sampling.
Start Course for Free4 Hours15 Videos51 Exercises
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Loved by learners at thousands of companies
Course Description
Sampling in Python is the cornerstone of inference statistics and hypothesis testing. It's a powerful skill used in survey analysis and experimental design to draw conclusions without surveying an entire population. In this Sampling in Python course, you’ll discover when to use sampling and how to perform common types of sampling—from simple random sampling to more complex methods like stratified and cluster sampling. Using real-world datasets, including coffee ratings, Spotify songs, and employee attrition, you’ll learn to estimate population statistics and quantify uncertainty in your estimates by generating sampling distributions and bootstrap distributions.
- 1
Introduction to Sampling
FreeLearn what sampling is and why it is so powerful. You’ll also learn about the problems caused by convenience sampling and the differences between true randomness and pseudo-randomness.
Sampling and point estimates50 xpReasons for sampling50 xpSimple sampling with pandas100 xpSimple sampling and calculating with NumPy100 xpConvenience sampling50 xpAre findings from the sample generalizable?100 xpAre these findings generalizable?100 xpPseudo-random number generation50 xpGenerating random numbers100 xpUnderstanding random seeds100 xp - 2
Sampling Methods
It’s time to get hands-on and perform the four random sampling methods in Python: simple, systematic, stratified, and cluster.
Simple random and systematic sampling50 xpSimple random sampling100 xpSystematic sampling100 xpIs systematic sampling OK?100 xpStratified and weighted random sampling50 xpWhich sampling method?100 xpProportional stratified sampling100 xpEqual counts stratified sampling100 xpWeighted sampling100 xpCluster sampling50 xpBenefits of clustering50 xpPerforming cluster sampling100 xpComparing sampling methods50 xp3 kinds of sampling100 xpComparing point estimates100 xp - 3
Sampling Distributions
Let’s test your sampling. In this chapter, you’ll discover how to quantify the accuracy of sample statistics using relative errors, and measure variation in your estimates by generating sampling distributions.
Relative error of point estimates50 xpCalculating relative errors100 xpRelative error vs. sample size50 xpCreating a sampling distribution50 xpReplicating samples100 xpReplication parameters50 xpApproximate sampling distributions50 xpExact sampling distribution100 xpGenerating an approximate sampling distribution100 xpExact vs. approximate50 xpStandard errors and the Central Limit Theorem50 xpPopulation & sampling distribution means100 xpPopulation & sampling distribution variation100 xp - 4
Bootstrap Distributions
You’ll get to grips with resampling to perform bootstrapping and estimate variation in an unknown population. You’ll learn the difference between sampling distributions and bootstrap distributions using resampling.
Introduction to bootstrapping50 xpPrinciples of bootstrapping100 xpWith or without replacement?100 xpGenerating a bootstrap distribution100 xpComparing sampling and bootstrap distributions50 xpBootstrap statistics and population statistics50 xpSampling distribution vs. bootstrap distribution100 xpCompare sampling and bootstrap means100 xpCompare sampling and bootstrap standard deviations100 xpConfidence intervals50 xpConfidence interval interpretation50 xpCalculating confidence intervals100 xpCongratulations!50 xp
In the following tracks
Data Analyst with PythonData Scientist with PythonData Scientist Professional with PythonStatistics Fundamentals with PythonCollaborators


Prerequisites
Introduction to Statistics in PythonJames Chapman
See MoreCurriculum Manager, DataCamp
James is a Curriculum Manager 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
Follow James on LinkedIn
Don’t just take our word for it
*4.4
70%
13%
11%
2%
4%
Sort by
- Sue D.26 days
The course is very interesting! The instructor is outstanding! The AI assistant is very impressive!
- Dániel K.about 1 month
'Sampling in Python' is a very interesting course, the course material is detailed and comprehensible even for someone inexperienced in probability.
- Tony F.about 1 month
A very good course, it gives you the necessary basis to get started in statistics.
- Michael C.about 2 months
Course appeared to be complete and with an appropriate level of rigor for me. Teacher was obviously of great quality. Needs to have an associated practice module. Thanks.
- Muhammad A.2 months
This is a good and important course. I think it would be better if some theoratical knowlege is added more but it may be biased because of my strong STEM background.
Join over 12 million learners and start Sampling in Python today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.