Разобраться с широко до длинного в пандах
pd.DataFrame(df.unstack().reset_index())
Talented Toucan
pd.DataFrame(df.unstack().reset_index())