1. Learn
  2. /
  3. Courses
  4. /
  5. Sampling in Python

Exercise

Simple random sampling

The simplest method of sampling a population is the one you've seen already. It is known as simple random sampling (sometimes abbreviated to "SRS"), and involves picking rows at random, one at a time, where each row has the same chance of being picked as any other.

In this chapter, you'll apply sampling methods to a synthetic (fictional) employee attrition dataset from IBM, where "attrition" in this context means leaving the company.

attrition_pop is available; pandas as pd is loaded.

Instructions

100 XP
  • Sample 70 rows from attrition_pop using simple random sampling, setting the random seed to 18900217.
  • Print the sample dataset, attrition_samp. What do you notice about the indices?