title: Python, reorganize the columns in a Pandas DataFrame
body: <p>I'm having a Pandas DataFrame named 'class_price_df':</p>
  
  <pre><code>                            email                 cat            class
  0               trangthanhtin@yahoo.com     Mobiles &amp; Tablets      1
  1                    concomai@yahoo.com     Mobiles &amp; Tablets      4
  2                   yenvo.ier@gmail.com     Mobiles &amp; Tablets      2
  3                   quyenvy71@yahoo.com     Mobiles &amp; Tablets      4
  </code></pre>
  
  <p>I'm grouping by 'email' and by 'cat' to have the max of 'class':</p>
  
  <pre><code>class_price_df = class_price_df.groupby(['email','cat']).max().unstack('cat').fillna(0)
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>cat                               Computers &amp; Laptops  Consumer Electronics   
  email                                                                         
  +coicon7879@gmail.com                               2                     0   
  +haiphong82lk@yahoo.com                             0                     2   
  +nguyentrungchanhbd@gmai.com                        0                     0   
  -abc@gmail.com                                      0                     0   
  001kukuku@gmail.com                                 0                     4  
  </code></pre>
  
  <p>How can I get an output similar to:</p>
  
  <pre><code>                 email                 Computers &amp; Laptops       Consumer Electronics
  0      +coicon7879@gmail.com                   2                             0  
  1      +haiphong82lk@yahoo.com                 0                             2 
  2      +nguyentrungchanhbd@gmai.com            0                             0   
  3      -abc@gmail.com                          0                             4
  </code></pre>
  
  <p>I tried</p>
  
  <pre><code>class_price_df.reset_index(inplace=True, level='class')
  </code></pre>
  
  <p>but the output is:</p>
  
  <pre><code>                            email                 class           \
  cat                                       Automotive &amp; Gadgets  Cameras   
  0                +841869087649@gmail.com                     0        0   
  1                  +coicon7879@gmail.com                     0        0   
  2                +haiphong82lk@yahoo.com                     0        0   
  3           +nguyentrungchanhbd@gmai.com                     0        0 
  </code></pre>