I am trying to stack multiple columns into two columns. my current dataframe looks in the following way with a timestamp and 4 other columns. I'd like to now stack the DIL and VOL column in the DRUG and VAL column.
current dataframe:
TIME DRUG VAL DIL VOL
2018-04-26 14:00:00 A 0.22 D5W 0.1
2018-04-26 19:00:00 B 0.38 D10W 0.22
2018-04-27 16:00:00 C 0.67 D5W 0.26
2018-05-02 16:00:00 A 0.22 N10W 0.1
expected dataframe:
TIME DRUG/DIL VAL/VOL
2018-04-26 14:00:00 A 0.22
2018-04-26 14:00:00 D5W 0.1
2018-04-26 19:00:00 B 0.38
2018-04-26 19:00:00 D10W 0.22
2018-04-27 16:00:00 C 0.67
2018-04-27 16:00:00 D5W 0.26
2018-05-02 16:00:00 A 0.22
2018-05-02 16:00:00 N10W 0.1
I tried the solution by using the following link as a reference but I couldn't what I want to achieve. I am pretty sure I am missing a small point and being dumb which I am unable to figure it out.
Pandas DataFrame stack multiple column values into single column
I'd really appreciate if I can get some help with it.