系統抽樣
有一種可以避免隨機性的抽樣方法稱為「系統抽樣」。在這種方法中,你會以固定的間隔從母體中挑選列。
例如,若母體資料集有 1,000 列,而你想要 5 個樣本,你可以挑選第 0、200、400、600 和 800 列。
已提供 attrition_pop;pandas 已以 pd 名稱載入。
本練習屬於課程
Python 中的抽樣
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Set the sample size to 70
sample_size = ____
# Calculate the population size from attrition_pop
pop_size = ____
# Calculate the interval
interval = ____