Hi I have a dataset as below stored as pandas data frame (df)
device_id domain date event product_label event Product_label1
11 Amazon 24112017 basket view TV
12 Tesco 30122017 basket view Coffe
15 Costco 20092018 basket view Clothes
I tried using the panda's stack function df.stack() which doesn't render the right format
Below is the format I want to reshape the data as,
device_id domain date event product_label
11 Amazon 24112017 basket
11 Amazon 24112017 view TV
12 Tesco 30122017 basket
12 Tesco 30122017 view Coffe
Referred to the below stack-overflow as well doesn't work for the above problem Python Pandas Wide to Long Format Change with Column Titles Spliting