From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

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

Solution: Joining DataFrames

Solution: Joining DataFrames

- [Instructor] All right, our solution code is up on the right. Let's go ahead and dive into the notebook. All right, so we have our retail and stores dataframes and the one shared column between our retail dataframe and our stores data frame is store number. So hopefully that made it pretty easy to deduce how many columns you needed to join on. Now let's go ahead and take a look at our call to the merge method. So we want to merge our retail dataframe with stores, so we're calling retail.merge. And if you play it around with this, you would find that we get a perfect join. It could be somewhat rare, but it doesn't actually matter if we do a left or inner join here. We'll get the same number of rows back because our store table was very nicely populated. There was one row for each store, and every store that exists in retail exists in our store's dataframe. So if we take a look at info, I'm calling it on the left join table so there's 1,054,000 rows, but if I call an inner join as…

Contents