title: Pandas dataframe count values for each column and sum in new index
body: <p>I have some data of use of phone devices by gender which I'd like to in pandas. </p>
  
  <p>I need to count the values and create a new column with those counts.</p>
  
  <p>This is what the data <code>df</code> look like: </p>
  
  <pre><code>Sex     Apple   Samsung Huawei  Tecno
  Male    Yes     Yes     No      No
  Female  Yes     Yes     No      No
  Female  Yes     Yes     No      No
  Male    Yes     Yes     No      No
  Male    No      Yes     No      No
  Female  No      No      No      No
  Female  Yes     Yes     No      No
  Male    Yes     Yes     No      No
  Male    Yes     Yes     No      No
  Male    Yes     Yes     No      No
  Female  Yes     Yes     No      No
  Female  Yes     Yes     No      No
  Female  Yes     Yes     No      No
  Female  Yes     Yes     No      No
  Female  No      Yes     No      No
  Female  Yes     Yes     No      Yes
  Male    Yes     Yes     No      No
  </code></pre>
  
  <p>This is what I want:</p>
  
  <pre><code>Sex     Response Apple  Samsung Huawei  Tecno
  Male    Yes      6      7       0       0
          No       1      0       7       7
  Female  Yes      8      9       0       1
          No       2      1       10      9
  </code></pre>
  
  <p>I'm spinning around in circles trying to get this to work and my code is so messy I'm a little ashamed to post it. I've at least started with this:</p>
  
  <pre><code>for name, group in df.groupby('Sex'):
      print(name)
      print(group)
  </code></pre>
  
  <p>I believe I can achieve this with some combination of <code>groupby</code> &amp; <code>unstack</code>. Also if someone could find a worthwhile tutorial on groupby of multilevel data, I would appreciate it.</p>