See picture attached for what I'm trying to accomplish. I have no problem melting over one column, but as soon as I try to loop, it breaks.
df = pd.DataFrame({'Group':['A','B','C'],'2002':[1,2,7],'2013':[3,4,8],'2016':[5,6,9]})
columns = df.columns
final_list = []
for Year in range(len(columns)):
list = df.melt(id_vars = ['Group'], value_vars = columns[Year])
final_list.append(list)
final_list
Get an error that Data needs to be 1-dimensional.