List of dictionaries
You recently got some new avocado data from 2019 that you'd like to put in a DataFrame using the list of dictionaries method. Remember that with this method, you go through the data row by row.
date | small_sold | large_sold |
---|---|---|
"2019-11-03" | 10376832 | 7835071 |
"2019-11-10" | 10717154 | 8561348 |
pandas
as pd
is imported.
This exercise is part of the course
Data Manipulation with pandas
Exercise instructions
- Create a list of dictionaries with the new data called
avocados_list
. - Convert the list into a DataFrame called
avocados_2019
. - Print your new DataFrame.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create a list of dictionaries with new data
avocados_list = [
{____: ____, ____: ____, ____: ____},
{____: ____, ____: ____, ____: ____},
]
# Convert list into DataFrame
avocados_2019 = ____
# Print the new DataFrame
____