Skip to content

Instantly share code, notes, and snippets.

@GeorgeSeif
Last active October 11, 2019 11:19
Show Gist options
  • Save GeorgeSeif/8d9bdecae6bbd2cd1183e51ac06e3e65 to your computer and use it in GitHub Desktop.
Save GeorgeSeif/8d9bdecae6bbd2cd1183e51ac06e3e65 to your computer and use it in GitHub Desktop.
df = df.stack()
print(df)
"""
0 Player Superman
Year 2000
Points 23
1 Player Batman
Year 2000
Points 43
2 Player Thanos
Year 2000
Points 45
3 Player Batman
Year 2001
Points 65
4 Player Thanos
Year 2001
Points 76
5 Player Superman
Year 2002
Points 34
6 Player Batman
Year 2002
Points 23
7 Player Thanos
Year 2002
Points 78
8 Player Black Widow
Year 2003
Points 89
9 Player Batman
Year 2004
Points 76
10 Player Thanos
Year 2004
Points 92
11 Player Superman
Year 2005
Points 87
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment