pandas: transforming the dataframegroupby object to desired format,df = df.reset_index()