I\'m working in zipline and pandas and have converted a pandas.Panel
to a pandas.DataFrame
using the to_frame()
method. This is the result
Because you have a MultiIndex in place already, stack
and unstack
are what you want to use to move rows to cols and vice versa. That being said, unstack
should do exactly what you want to accomplish. If you have a DataFrame df
then df2 = df.unstack('minor')
should do the trick. Or more simply, since by default stack
/unstack
use the innermost level, df2 = df.unstack()
.