利き手に基づく重み付きサンプリング
あなたは左利きに関する研究を行う大学の研究チームの一員です。大学のソーシャルメディアを通じて調査を実施し、参加者に特定の作業でどちらの手を使うかを尋ねます。調査では、回答者の性別 Gender、年齢 Age、利き手 Left - right handed を収集します。
データセット、pandas、matplotlib.pyplot はそれぞれ hand_survey、pd、plt として読み込まれています。
この演習はコースの一部です
Pythonで学ぶアンケートデータ分析
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Groupby Gender and Handedness
hand_survey = hand_survey.groupby(
[____])[
____].____.reset_index()
hand_survey.columns = ['Gender','Handedness','Respondents']
# Create new column that calculates the percentage of each respondent type
hand_survey['% total respondents'] = ____*100./____.sum()