Multiple levels or summaries of data

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:

  1. I read in a csv file with all of the levels I mention above. The columns are state, city, store, month sales.
  2. 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.

That sounds fine to me, @Jfrick100
Unless it really slows your process down, I would do what you’re doing.
I recommend looking into the px.sunburst() It’s great for the data type you have.