Merging Data

In this lesson, an explanation on how to merge different data sets is provided.

Merge

To merge the rows of two or more DataFrames based on a common column between them, use pandas merge(df1, df2, ...) function. This returns another DataFrame with only the common column(s) and their corresponding row values.

In short, two things need to be in common for the DataFrames to be merged:

  • The column names

  • The row values of those column names

Get hands-on with 1400+ tech skills courses.