I am struggling with pandas transformation, that I would expect to be quite easy. I have the following 2D (10 x 6) data frame:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(10,6), columns=['A1', 'A2', 'A3', 'B1', 'B2', 'B3'])
I would like to have a corresponding 3D (3 x 2 x 10) data frame, where instead of 1D row from above (A1, ..., B3), there is a 2D new DF:
A1 A2 A3
B1 B2 B3
Is this achievable in few lines?