0

I also visited official docs but same syntax is given. Here's my code.

df = pd.DataFrame({'team': ['A', 'B', 'C', 'D'],
               'points': [88, 91, 99, 94],
               'assists': [12, 17, 24, 28],
               'rebounds': [22, 28, 30, 31]})
pd.melt(df, id_vars = ['team'], value_vars = ['points','assists'])
df
buhtz
  • 10,774
  • 18
  • 76
  • 149
  • 2
    What are your expected results? Did you know you didn't reset your dataframe to the melt results because you did not `df = pd.melt(df, id_vars = ['team'], value_vars = ['points','assists'])` – ArchAngelPwn Jul 18 '22 at 14:31
  • Not sure what you want but maybe you just have to catch the return value: `df = pd.melt(df, ....)`. Pandas don't manipulate the original input data frame. – buhtz Jul 18 '22 at 14:37
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jul 18 '22 at 16:24

0 Answers0