I have a table like the one shown below:
I want the output to be displayed in the following format in a dataframe: