My objective is to build an N-dimensional array in Python that has the mean of the intersection of a number of features.
For example, I have the number of customers in a store at any given time. I want to create a three dimensional array with axes [month, day_of_week, hour] where the values are the mean of the historical values.
One example data point, where the data covers several years but each axis here is just 12 months, 7 days, and 24 hours.
Array[January,Friday,1pm] = 3 customers on average
I've tried Pandas Groupby but I can't figure out how to translate that information from a Groupby object or Panel to a useful 3D array.
My closest attempt so far:
This outputs a Panel object, but I can't find a way to translate this to just a 3D array.
Can anyone help me figure out a way to solve my problem and build this 3D array without for loops?