Move from Excel to Python with Pandas Transcripts
Chapter: Case study walk through: Sales commissions
Lecture: Combining customer sales reps
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
in the previous exercise, we looked at customer information and figured out the effective sales
0:05
commission rate per customer. But what we need to figure out now is how do
0:09
we pull in the sails rap associated with each customer?
0:13
So I'm going to create a new notebook,
0:15
and I'm keeping my original notebook open because I may want to copy and pay some
0:20
of the data between so I can leverage the work I did in the past.
0:23
So in this example, I started my new notebook and filled in the information at
0:27
the top. Now I'm going to give my imports and the other piece on one
0:31
of leverages the data that I already have to read in the file so and copy
0:37
and paste that over. It's still going to read in our customer master.
0:40
I'm still gonna leave that report file in place so that I can use it in
0:44
the future, and then we'll remember when we read in this file.
0:48
We already figured out how to read in the file using the ZIP code correctly.
0:52
I'm gonna call this a different data frame,
0:54
though they call it the of Customers.
0:56
And the other thing I'm gonna do.
0:58
It's actually specify the sheet name,
1:02
and the reason it worked before is because customers is the first sheep name.
1:07
Now we've read in her file,
1:09
and the other sheet is the sales reps.
1:13
So let's go ahead and read that in a swell.
1:21
This is just the sale sheet.
1:29
Now we read in the sales rep.
1:30
So we have the sales rep information and our customers,
1:34
and we want to join these two data frames.
1:36
Together. You'll notice a challenge.
1:38
The sales reps are identified by region,
1:41
but our customers on Lee have a state,
1:43
so we don't have a good way to tie those two together.
1:48
So let's walk through how we would do that.