I am trying to convert the following pandas df
Error Fore time loc qty con FA
2960 32863 2086 CFA Ahmedabad 29903 1 90
2960 32863 2087 CFA Ahmedabad 29903 1 90
8090 71453 2086 CFA Bangalore 79543 2 90
8090 71453 2087 CFA Bangalore 79543 2 90
to
loc var 2086 2087
CFA Ahmedabad qty 29903 29903
CFA Ahmedabad Fore 32863 32863
CFA Ahmedabad Error 2960 2960
CFA Ahmedabad con 1 1
CFA Ahmedabad FA 90 90
I have tried using melt/stack but nothing seems worked
df = pd.melt(df, id_vars='loc', value_vars=var, value_name='time')
this code is not working to get columns as time, any idea will be much appreciated?