Joins in DataFrames
Get a look at the theory for joining DataFrames.
We'll cover the following...
Joins
Databases have different types of joins. The four common ones include inner, outer, left, and right. The DataFrame has two methods to support these operations, join and merge. It’s preferred to use the merge method.
Note: The
joinmethod is meant for joining based on the index rather than columns. In practice, joining is usually based on columns instead of index values.
If we want thejoinmethod to join based on column values, we need to set that column as the index first:
df1.set_index('name').join(df2.set_index('name'))
It’s easier to just use themergemethod.
The default join type for the merge method is an inner join. ...
Ask