BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Sampling in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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?

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Sample 70 rows using simple random sampling and set the seed
attrition_samp = ____

# Print the sample
____
Kodu Düzenle ve Çalıştır