Move from Excel to Python with Pandas Transcripts
Chapter: Data I/O (input and output)
Lecture: Demo: Simple Excel saves
0:00 Now I will walk through how to save an Excel file,
0:02 have created the notebook and included in my standard imports at the top,
0:07 as well as to finding the source file,
0:09 which we mark through in the previous videos and the report file that we're going to
0:13 create. So now let's read in the sales data from the source file.
0:20 I've read in the data from the sales data us worksheet in the file,
0:24 and I'm only using columns a through G.
0:27 This shows the sales data in our spreadsheet,
0:30 and now I'm gonna build a couple summary reports that we can include in our output
0:36 Excel file. So first I'm gonna build a sale summary.
0:49 We used our group by the group by company and product into some how much each
0:54 customer spent. So this is a very simple report.
0:57 This tells us by customer and product how much they purchased,
1:01 which is a really nice summary view of the data.
1:04 We could also look at average sales,
1:16 and this is definitely a higher level summary of the average sale and the total amount
1:21 that we've sold. And I don't like having this in a in here,
1:25 so I'm going to now we have a good summary table of all of our sales
1:31 And now let's build a pivot table of product sales.
1:35 So we'll call this one product summary.
1:43 This is another good summary of our product information so we can see how much we
1:47 spend per product what the average transaction was per product,
1:51 as well as how many transactions we had for each product.
1:54 Very useful summary in a very short amount of code.
1:58 Now, if we want to save one of these data frames to Excel file,
2:01 it's fairly simple. And now that data frame has been written to the report file
2:09 Now I've opened up that file.
2:12 He can see that the data looks very similar to the original data frame,
2:17 which is useful, but we would want to be able to build something a little
2:20 more powerful where we include information on multiple sheets and maybe different locations on the worksheet