1

I have a pivot table, for example,

first second                    
bar   one  
      two    
foo   one  
      two 

How do I change it back to a normal dataframe with all values and rows and column filled?

first second                    
bar   one 
bar   two  
foo   one 
bar   two
pnkjmndhl
  • 565
  • 3
  • 7
  • 21

1 Answers1

4

if table is the name of your pivottable and df is the new dataframe,

df = table.reset_index()
pnkjmndhl
  • 565
  • 3
  • 7
  • 21