 Hi, in this video, we're going to cover merging data frames. So we're going to continue with our state energy ranking data from the Energy Information Administration. In this video, we're going to merge the natural gas data frame, NGDF, with the total energy data frame, TEDF. Let's exemplify this first with the intermerge. This is the default method. And we'll do this by creating a new data frame. It's called DF, generically. PD, to reference pandas, merge these two objects, NGDF, TEDF. So we want to merge the natural gas with the total energy. We also need to specify on which variable to merge. So let's do this by state. That is, it's going to match Texas and natural gas with Texas in total energy, Pennsylvania in the first, Pennsylvania in the second, and so on and so forth. So it's going to pair them on a basis of state. Let's see what this looks like. Here we go. So we've got, first, the rankings. We've got rank underscore x. That's interesting. What does that mean? Well, these are the rankings from the natural gas data frame. That's our first data frame. So it gives it the subscript x as opposed to rank y. So this is the rank from the second one. Note that these two variables were called the same thing, so it automatically appended these x and the y to distinguish the two. Then we have state. This was our variable, our key variable that we're performing the merge on. So we have all the states here. And then we've got our natural gas and our total energy. And now this miraculous function has automatically paired the values according to what state they belong to. However, there's a problem with this. If we scroll down, we don't have all the states. This stops at 33. Note that the indexes for this start at 0. So we've got 33 states here. There really ought to be 51, 50 states plus DC. So what happened? Why did it get rid of those? Well, it only kept the states that were equal in natural gas and total energy. Recall that in the natural gas data frame, we had some states that had their full names in there. Let's try this a different way. Let's try it with the outer join. So we'll say DF. Again, pd for pandas.merge. And again, we'll have our ngdf, our tedf, on equals state. And now we'll say how is outer. So we're going to do an outer merge. Let's see what result we get here. So we still have our rank x, our rank y. That all looks the same. But now we've got down to 69 states. Well, that's strange. That's too many. We'll click on this thing to just get a better inspection of the output here. What's going on? If we scroll down, we need to display some more values here. We see that we've got these states by name here that don't have any data in natural gas production, no total energy production. And then we've got their corresponding acronyms. So how did this happen? Well, the natural gas production data set had these states listed out in their full name, because they didn't produce any natural gas, so it listed them differently for whatever reason. Whereas the total energy data set does have data for these states and uses their two-letter abbreviation. And the merge function can't associate these two things because it's just not that intelligent. It doesn't recognize that Hawaii is abbreviated HI. We would need to tell it that. So what do we do? Well, this will be for the next video, logic and sub-setting. Solve that problem there. For now, that's it for merging.