0

I have a pandas DataFrame like below:

   Alex  Jeremy  Sam  Lucas
0    10      10   15     15
1    10      10   15     15
2     5      10   10     15
3     5      10   10     10
4     5      10    5     10
5     0      10    5      5
6     0       5    0      5
7     0       0    0      0

And I need to convert it to this: (I apologize for the large chunk of text)

      Name  Age
0     Alex   10
1     Alex   10
2     Alex    5
3     Alex    5
4     Alex    5
5     Alex    0
6     Alex    0
7     Alex    0
8   Jeremy   10
9   Jeremy   10
10  Jeremy   10
11  Jeremy   10
12  Jeremy   10
13  Jeremy   10
14  Jeremy    5
15  Jeremy    0
16     Sam   15
17     Sam   15
18     Sam   10
19     Sam   10
20     Sam    5
21     Sam    5
22     Sam    0
23     Sam    0
24   Lucas   15
25   Lucas   15
26   Lucas   15
27   Lucas   10
28   Lucas   10
29   Lucas    5
30   Lucas    5
31   Lucas    0

I have tried many different combinations of Pivot Tables, melting, loading without the headers, etc. How would I go about doing this? Thank you!

SanguineL
  • 1,189
  • 1
  • 7
  • 18

0 Answers0