Aan de slagGa gratis aan de slag

Is systematic sampling OK?

Systematic sampling has a problem: if the data has been sorted, or there is some sort of pattern or meaning behind the row order, then the resulting sample may not be representative of the whole population. The problem can be solved by shuffling the rows, but then systematic sampling is equivalent to simple random sampling.

Here you'll look at how to determine whether or not there is a problem.

attrition_pop is available; pandas is loaded as pd, and matplotlib.pyplot as plt.

Deze oefening maakt deel uit van de cursus

Sampling in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Add an index column to attrition_pop
attrition_pop_id = ____

# Plot YearsAtCompany vs. index for attrition_pop_id
____
plt.show()
Code bewerken en uitvoeren