From the course: Python Data Visualization: Create Impactful Visuals, Animations, and Dashboards by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Merge and join

Merge and join

Very often, we need to combine data from different data frames. If you're familiar with databases, they essentially correspond to join operations on two different tables. Pandas provides us with the merge and join functionality that essentially allows us to do this just as we would in a data frame. Merge and join work very similarly with one notable exception that we're going to mention in a second. But we always have to provide essentially two arguments for either of these functions. You have to provide on, so these are essentially the column names on each of the data frames we're going to be matching on. On typically expects that the column name is the same on both DataFrames and you just specify giving it the name, and it's going to use the matching rows with one value on the left DataFrame with rows with the same value on the right DataFrame. You also have to specify how, so essentially the type of join that you want to perform. You can have a left join, right join, outer join, or…

Contents