I have a dataframe where I want to convert the columns headers into aggregated rows and a column into the header:
Athlete Variable 28.0 28.0 28.0 29.0 29.0 29.0
John Minutes 23 32 43 21 43 35
John Distance 23.2 32.7 54.2 24.2 47.8 32.1
John Sprints 5 3 8 3 9 2
Bob Minutes 25 23 43 31 38 23
Bob Distance 32.4 35.6 43.7 21.8 26.8 12.5
Bob Sprints 8 4 8 6 9 2
Desired dataframe:
Athlete week Minutes Distance Sprints
John 28 98 110.1 16
John 29 99 104.1 14
Bob 28 91 111.7 20
Bob 29 92 61.1 17