I have a situation where I would like to transpose a certain set of columns in my dataframe to rows. The columns range which I want to transpose starts from the fourth column till the last column. There are multiple datasets so one of the datasets can have 10 columns the other one could have 20. The idea is to transpose the columns starting from fourth to the last column.
My example dataset looks like this:
s_date e_date response_id Q1 Q2 Q3 Q4 Q5
12/12/2020 12/12/2020 1 Yes No Good No Yes
I want this set to transposed as following:
s_date e_date response_id Question_text Question_Response
12/12/2020 12/12/2020 1 Q1 Yes
16/12/2020 17/12/2020 1 Q2 No
15/12/2020 18/12/2020 1 Q3 Good
14/12/2020 19/12/2020 1 Q4 No
13/12/2020 20/12/2020 1 Q5 Yes
How can I achieve this?