Enriching a dataset
Setting how='left'
with the .merge()
method is a useful technique for enriching or enhancing a dataset with additional information from a different table. In this exercise, you will start off with a sample of movie data from the movie series Toy Story. Your goal is to enrich this data by adding the marketing tag line for each movie. You will compare the results of a left join versus an inner join.
The toy_story
DataFrame contains the Toy Story movies. The toy_story
and taglines
DataFrames have been loaded for you.
This exercise is part of the course
Joining Data with pandas
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Merge the toy_story and taglines tables with a left join
toystory_tag = toy_story.merge(____)
# Print the rows and shape of toystory_tag
print(toystory_tag)
print(toystory_tag.shape)