손잡이 경향에 대한 가중치 표본추출
여러분은 왼손잡이에 관한 연구를 수행하는 대학 연구팀의 일원입니다. 대학의 소셜 미디어 플랫폼을 통해 설문을 진행하여, 참가자들에게 특정 작업을 할 때 어느 손을 사용하는지 물었습니다. 설문에서는 응답자의 성별 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()