部落格調查
你是一位部落客,發現到 2014 年為止,前 7 位美國總統中有 4 位是左撇子。出於好奇,你對讀者做了一份調查,詢問他們在特定任務上慣用哪隻手。你的調查請受訪者填寫性別 Gender、年齡 Age,以及慣用手 Left - right handed。
資料集、pandas 與 matplotlib.pyplot 已分別以 hand_survey、pd、plt 名稱為你載入。
本練習屬於課程
使用 Python 分析問卷資料
練習說明
- 建立交叉表,統計左撇子與右撇子、男性與女性受訪者的人數。
- 將結果繪製為水平長條圖。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create a crosstab of male and female handedness
survey_crosstab = pd.____(____,____)
# Create a horizontal bar plot of your results
____
plt.show()