0

I'm trying to pivot this table so that columns 1-8 are stacked under column 0. Basically, I want to put this into tableau eventually so I want to have workable data. I'm planning on dropping the "None" values after I pivot the table.

I've tried using pd.melt but kept getting errors.

sbottingota
  • 533
  • 1
  • 3
  • 18
Zoey K
  • 1
  • 1

1 Answers1

0

You should, in fact, use pd.melt. Check your syntax, below is an example:

df = pd.melt(df, id_vars=['col0'], value_vars=['col1', 'col2', 'col3', 'col4', 'col5', 'col6', 'col7', 'col8'], var_name='variable', value_name='value')
GoostyGAM
  • 16
  • 1