清單組成的字典
又有一些資料進來了!這次你要用「清單組成的字典」這個方法,逐一解析每個欄位來建立資料。
| date | small_sold | large_sold |
|---|---|---|
| "2019-11-17" | 10859987 | 7674135 |
| "2019-12-01" | 9291631 | 6238096 |
pandas 已以 pd 名稱匯入。
本練習屬於課程
使用 pandas 進行資料操作
練習說明
- 用新資料建立一個由清單組成的字典,命名為
avocados_dict。 - 將該字典轉成一個 DataFrame,命名為
avocados_2019。 - 列印(print)你的新 DataFrame。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create a dictionary of lists with new data
avocados_dict = {
"____": [____],
"____": [____],
"____": [____]
}
# Convert dictionary into DataFrame
avocados_2019 = ____
# Print the new DataFrame
____