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

Stratified sampling

You are a part of an agency that sent out a youth survey to a nationally representative sample of youths, ages 14 to 20 years old. The uploaded dataset, youth_survey, tracks the Age, Height (in inches), Weight (in pounds), Gender, and the self-reported How would you describe your weight? multiple choice answers for the individuals.

In this exercise, you will create a stratified, weighted sample of 1% of respondents from the dataset. pandas has been imported as pd.

The dataset contains information on all respondents' genders, so you will be using the Gender column as the stratifying column.

Bu egzersiz

Analyzing Survey Data in Python

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

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Calculate the percentage of female and male respondents
print(youth_survey.Gender____(normalize=____) * 100)
Kodu Düzenle ve Çalıştır