Merging—Types of Joins

Understand the types of JOIN operations that can be applied to pandas DataFrames.

Joins

While concatenation allows us to stitch DataFrames along the row or column axis, it doesn’t give us full flexibility in implementing the different ways of combining DataFrames.

Joins are how different datasets are combined to bring various important information together. For example, given a set of online transaction data, we would want to connect them to customer information to understand spending patterns at the demographic level.

Press + to interact
Joining pieces of information together (e.g., transactions and customer information) can deliver valuable data insights
Joining pieces of information together (e.g., transactions and customer information) can deliver valuable data insights

In terms of technical definition, a JOIN is an operation that combines rows from two or more tables (i.e., DataFrame objects) based on related columns between them. In the example above, the related column is the "Customer ID" column that exists in both the "Transactions" and "Customers" tables.

If you’ve dealt with relational databases with Structured Query Language (SQL), the concept of joins will be familiar to you. Based on the standard SQL terminology, there are five types of JOIN:

    ...

    Get hands-on with 1400+ tech skills courses.