You are looking for .reset_index() .
In [11]: df = pd.DataFrame([[2, 3], [5, 6]], pd.Index([1, 4], name="A"), columns=["B", "C"]) In [12]: df Out[12]: BC A 1 2 3 4 5 6 In [13]: df.reset_index() Out[13]: ABC 0 1 2 3 1 4 5 6
Note. To avoid this step, use as_index=False when doing groupby.
step1 = step3.groupby(['Id', 'interestingtabsplittest2__grp'], as_index=False)['applications'].sum()
source share