リストの辞書
新しいデータがさらに届きました!今回は、リストの辞書を使う方法で、データを列ごとに整理していきます。
| date | small_sold | large_sold |
|---|---|---|
| "2019-11-17" | 10859987 | 7674135 |
| "2019-12-01" | 9291631 | 6238096 |
pandas は pd としてインポートされています。
この演習はコースの一部です
pandas によるデータ操作
演習の手順
- 新しいデータを使って、
avocados_dictという名前のリストの辞書を作成します。 - その辞書を
avocados_2019という名前の DataFrame に変換します。 - 作成した DataFrame を出力します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Create a dictionary of lists with new data
avocados_dict = {
"____": [____],
"____": [____],
"____": [____]
}
# Convert dictionary into DataFrame
avocados_2019 = ____
# Print the new DataFrame
____