Un-nesting birds
Finally, your job for the day is done, but your colleague asked you a last minute favor. A client has provided data about birds he wants to classify.
You examine the data and realize that it's in a bad format - the list of birds is in one file, and the characteristics of the birds are in another.
You manage to read the bird names into a list called names
. You read the bird facts into another list called bird_facts
, but this list contains dictionaries in string format.
To have a usable DataFrame, you will need to perform several operations.
Both the names
and bird_facts
lists are available in your session. Make sure to examine it in the console! The json
module is pre-loaded.
This exercise is part of the course
Reshaping Data with pandas
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define birds reading names and bird_facts lists into names and bird_facts columns
birds = pd.DataFrame(____(____=____, ____=____))
# Print birds
print(birds)