Inner joins and number of rows returned
All of the merges you have studied to this point are called inner joins. It is necessary to understand that inner joins only return the rows with matching values in both tables. You will explore this further by reviewing the merge between the wards
and census
tables, then comparing it to merges of copies of these tables that are slightly altered, named wards_altered
, and census_altered
. The first row of the wards
column has been changed in the altered tables. You will examine how this affects the merge between them. The tables have been loaded for you.
For this exercise, it is important to know that the wards
and census
tables start with 50 rows.
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 wards and census tables on the ward column
wards_census = wards.merge(____)
# Print the shape of wards_census
print('wards_census table shape:', wards_census.shape)