title: Pandas - Pivot Multiple Categorical Columns
body: <p>I have a dataframe as such:</p>
  
  <pre><code>name = ['fred','fred','fred','james','james','rick','rick','jeff']
  actionfigures = ['superman','batman','flash','greenlantern','flash','batman','joker','superman']
  cars = ['lamborghini', 'ferrari','bugatti','ferrari','corvette','bugatti','bmw','bmw']
  pets = ['cat','dog','bird','cat','dog','dog','fish','marmet']
  
  test = pd.DataFrame({'name':name,'actfig':actionfigures,'car':cars,'pet':pets})
  
      actfig       car                name    pet
  0   superman     lamborghini        fred    cat
  1   batman       ferrari            fred    dog
  2   flash        bugatti            fred    bird
  3   greenlantern ferrari            james   cat
  4   flash        corvette           james   dog
  5   batman       bugatti            rick    dog
  6   joker        bmw                rick    fish
  7   superman     bmw                jeff    marmet
  </code></pre>
  
  <p>Forgive me if my terminology is incorrect, but I want to pivot the data so that I get counts for each value in the ['actionfigures','car','pet'] columns for each name. </p>
  
  <pre><code>    batman  flash   greenlantern    joker   superman    bmw bugatti corvette    ferrari lamborghini bird    cat dog fish    marmet
  name                                                            
  fred    1   1   0   0   1   0   1   0   1   1   1   1   1   0   0
  james   0   1   1   0   0   0   0   1   1   0   0   1   1   0   0
  jeff    0   0   0   0   1   1   0   0   0   0   0   0   0   0   1
  rick    1   0   0   1   0   1   1   0   0   0   0   0   1   1   0
  </code></pre>
  
  <p>I would have thought that <code>test.pivot_table(index='name',columns=['actfig','car','pet'],aggfunc='size'])</code> would do it, but it gives me some weird multi-level columns.</p>
  
  <p>Thinking maybe I could concat <code>get_dummies</code> for each column then groupby name and sum, but feel like pandas prob has a better way.</p>
  
  <p>How would this be done?</p>