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.
0:06 So we now need to do a join so that we can add this region column
0:11 to our customers. The way we want do that is to use PD merge.
0:21 Take a look at what this is telling us.
0:24 Is joining emerging The customers in the states and then left on and right on are
0:30 telling us that state and state code are essentially the same values.
0:34 And that's what we want to use to merge the two data frames together.
0:38 We do need to make sure we actually assigned this to a variable.
0:41 So we're gonna call this customer.
0:45 We have to state columns, state code and state.
0:48 So we're gonna drop one of those.
0:56 And now we have our region in here as well as on Lee One State column
1:00 It's also good to take a look at the shape just to make sure everything
1:04 worked as expected. So we saw 50 values,
1:07 which is what we would expect now the final pieces we need to bring our sales
1:11 rep it so can do another merge.
1:17 Let's take a look at the values.
1:19 It looks like it works. We need to make sure we actually assign that to
1:22 a variable. We'll call this one customer rap,
1:27 and we're also gonna drop the extra region.
1:39 Now, if we look at our data frame,
1:40 we have each customer. We have the city and state.
1:43 We have the region and we have the first name and last name as well as
1:47 the tenure of the sales rep.
1:51 And the key thing is we have 50 rows,
1:54 so it looks like all of our values have merged correctly as we would expect.