How should I handle dataframe(s) for data that has multiple levels or grains of detail?
I am trying to build a dashboard that shows multiple charts for sales by state, sales by city, sales by store. (This is a simple example. In reality I have a larger number of levels and charts than this.)
I can get this to work this way:
- I read in a csv file with all of the levels I mention above. The columns are state, city, store, month sales.
- I do pandas drops and group bys to create a new data frame per chart. The data frames I currently have are:
- state, sales
- city, sales
- store, sales
Is this a good solution though? Since my goal is to include much more data and create many more charts, I wonder if it is good practice to create a new data frame per each level or aggregation.
What is the best way to handle data frames when there are multiple charts on a dashboard and each has a different level or grain of detail?
This may be more of a Pandas or numpy question.
Thanks for any help.