Move from Excel to Python with Pandas Transcripts
Chapter: Case study walk through: Sales commissions
Lecture: Merging sales reps

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's take a look at our data frames again. So we now need to do a join so that we can add this region column
0:12 to our customers. The way we want do that is to use PD merge. Take a look at what this is telling us.
0:25 Is joining emerging The customers in the states and then left on and right on are telling us that state and state code are essentially the same values.
0:35 And that's what we want to use to merge the two data frames together. We do need to make sure we actually assigned this to a variable.
0:42 So we're gonna call this customer. We have to state columns, state code and state. So we're gonna drop one of those.
0:57 And now we have our region in here as well as on Lee One State column It's also good to take a look at the shape just to make sure everything
1:05 worked as expected. So we saw 50 values, which is what we would expect now the final pieces we need to bring our sales rep it so can do another merge.
1:18 Let's take a look at the values. It looks like it works. We need to make sure we actually assign that to a variable. We'll call this one customer rap,
1:28 and we're also gonna drop the extra region. Now, if we look at our data frame, we have each customer. We have the city and state.
1:44 We have the region and we have the first name and last name as well as the tenure of the sales rep. And the key thing is we have 50 rows,
1:55 so it looks like all of our values have merged correctly as we would expect.

Talk Python's Mastodon Michael Kennedy's Mastodon