Reshape Pandas Dataframe and group by 2 level columns I have a dataframe with flat structure of having unique Rows as follow.