Skip to content Skip to sidebar Skip to footer

Stacking And Unstacking

I have a data frame with a month-status index: var1 var2 date status 2003-01-01 foo 5.673044e+12 1.4128

Solution 1:

Just don't unstack in the first place:

#df = df.unstack(level='status')test = df.join(otherDf)

join() is smart enough to match up the indices from otherDf to the larger number of indices in df without you unstacking and re-stacking.

Post a Comment for "Stacking And Unstacking"