I have following dataframe df:
data = {'SAP ID': ['MATSAP1', 'MATSAP2'],
'DESCRIPTION': ['DESC1', 'DESC2'],
'BASIC': ['BD1', 'BD2'],
'LINK': ['MD1', 'MD2']}
df = pd.DataFrame(data)
I want to melt the df and have the following output:
However, on using the below code, getting ouput:
df_melted = pd.melt(df,id_vars=['SAP ID'], value_vars=df.columns.tolist())
Is there anyway through which this can be achieved?