Imagine you work in an international delivery company. You have just been handed an Excel spreadsheet shipments.xlsx that holds the shipment data to your customers for the current quarter. You need to crunch some 90,000+ rows of Excel data in the spreadsheet and compute the total shipment values & dispatch trips made to selected destination cities.
Your usual go-to tool for this sort of grunt work is the trusty Excel’s pivot table. Not this time though. You found out that some dimwit has password protected the spreadsheet! Now, you can’t even select any Excel cells on the spreadsheet, let alone run a pivot table. And, your boss urgently needs your analysis report in 30 minutes. Tough luck!
Just when you are about to have a total melt down, your smart intern suggests a Python solution. He can whip out some Python codes to read the Excel data, do the computations and pack them into nested dictionaries. With the Python’s nested dictionaries, data extraction will be super easy and fast! “Cool! Why didn’t I think of that?” …
Here’s the solution: