https://www.crunchbase.com/organization/indigo-slate
Indigo Slate is a digital marketing focused customer experience agency.
Position: Software Engineer
large retailers (bestbuy, costco, walmart, amazon of course) might have a million
or more separate items/SKUs in their inventory. Usually these products will be organized into
a taxonomy/heirarchy of classification. For instance: electronics -> computers -> tablets
Today you’ve come in to work and have been given a multi-gb file containing millions of rows
of items, each item is placed into one a number of categories, and you’ve been asked to
provide a count of the number of items in each level of each category.
For instance if there are 3 items in “electronics/computers”, 5 in “electronics/audio” and 100
in “books”, then you should return an output like:
/ (root) 108
books/ 100
electronics/ 8 <- 8, because there are 5 under audio, and 3 under computers
electronics/audio 5
electronics/computers 3 <- 3, because there are 2 laptops & one tablet
electronics/computers/tablets 1
electronics/computers/laptops 2
For our purposes, assume you have a CSV file organized like this:
item_id,name,category
1,Apple Macbook Air,/electronics/computers
2,The Lord of the Rings,/books
3,Salt and Vinegar Chips,/food/snackfoods/potato_chips
…
10000000,Something Else,/some/other/random/category
Write a function that will take a CSV file input in this format, and output a
summary in a format similar to the one shown above