Panel is probably the right way to start:
p = Panel(dict(zip(range(5), dfs)))
In [29]: p.swapaxes(0, 2).swapaxes(2, 1).to_long()
Out[29]:
A B
0 a 0.02896 -0.01355
b -0.03215 0.01948
1 a 0.01272 -0.005954
b -0.01412 0.008555
2 a -0.05341 0.025
b 0.0593 -0.03593
3 a 0.3682 -0.1723
b -0.4087 0.2477
4 a -0.1489 0.0697
b 0.1653 -0.1002
Looks like to_long completely discards the index names. The returned
LongPanel object *is* a DataFrame, but I'm going to get rid of that
subclass altogether soon (probably 0.7.0)
In [33]: DataFrame(p.swapaxes(0, 2).swapaxes(2, 1).to_long())
Out[33]:
A B
0 a 0.02896 -0.01355
b -0.03215 0.01948
1 a 0.01272 -0.005954
b -0.01412 0.008555
2 a -0.05341 0.025
b 0.0593 -0.03593
3 a 0.3682 -0.1723
b -0.4087 0.2477
4 a -0.1489 0.0697
b 0.1653 -0.1002
issue for the to_long names being discarded:
https://github.com/wesm/pandas/issues/525
this part of the API (interplay between Panel and DataFrame) is pretty
malleable if you have some ideas for 3D<->2D manipulations