變異程度的量測
在研究完受訪者的次數分配後,身為研究者的你想進一步分析這份問卷。還記得這份名為 dietary_habits 的問卷嗎?它詢問了參與者的年齡層(Age)、性別(Gender)、一天用餐次數(meals_per_day),以及每週外帶或外食的次數(eat_out_per_wk)。
在這個練習中,你將為問卷資料中的各個變項計算變異程度。
pandas 已為你載入為 pd。
本練習屬於課程
使用 Python 分析問卷資料
練習說明
- 找出外食或外帶次數的區間。
- 找出外食或外帶次數的標準差。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Find the range of meals eaten out or ordered
range_value = ____
print(range_value)
# Find the standard deviation of meals eaten out or ordered
std_dev_value = ____
print(std_dev_value)