After grouping procedure for DataFrame, I have table structured this way:
sum count
endAt id
2021-01-02 628 100.0 1
2021-01-03 628 300.0 1
2021-01-06 32 100.0 1
2021-01-07 629 50.0 1
2021-01-08 619 150.0 2
... ... ... ...
2021-04-22 860 100.0 2
861 150.0 2
869 350.0 6
876 100.0 1
883 200.0 4
Tried to pivot table but stuck with re-indexing the structure. is a way to restructure DataFrame with following indexes:
colums = pd.MultiIndex.from_product([['2021-01-01', '2021-01-02', ....],['sum','count']], names=['date','types'])
index = pd.MltiIndex.from_product([32,619,628,....],names=['id'])
and get DataFrame structured like:
id endAt 2021-01-02 2021-01-02
sum count sum count
32 100 1 200 2
619 0 0 100 1
628 300 3 0 0
...........
883 100 1 200 2