開始使用免費開始

次數分配

針對不同族群研究飲食習慣,有助於了解個人與群體在健康與生活型態等各方面的許多面向。因此,問卷 dietary_habits 請受訪者提供其年齡層 Age、性別 Gender、每天用餐次數 meals_per_day,以及每週外帶或外食的次數 eat_out_per_wk

在本練習中,你要為問卷資料中各年齡層的回覆數建立一個次數分配。

pandas 已載入為 pdmatplotlib.pyplotplt

本練習屬於課程

使用 Python 分析問卷資料

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Count the number of responses for each age group
freq_dist = ____.____.____().____('Number')
print(freq_dist)
編輯並執行程式碼