I'm trying to left join multiple pandas dataframes on a single Id
column, but when I attempt the merge I get warning:
KeyError: 'Id'.
I think it might be because my dataframes have offset columns resulting from a groupby
statement, but I could very well be wrong. Either way I can't figure out how to "unstack" my dataframe column headers. None of the answers at this question seem to work.
My groupby
code:
step1 = pd.DataFrame(step3.groupby(['Id', 'interestingtabsplittest2__grp'])['applications'].sum())
step1.sort('applications', ascending=False).head(3)
Returns:
How to get those offset headers into the top level?
question from:https://stackoverflow.com/questions/33004573/after-groupby-how-to-flatten-column-headers