title: Aggregate a dataframe and count for each category
body: <p>I have the following dataframe:</p>
  
  <pre><code>time             city             
  2018-05-8        sydney        
  2018-05-8        sydney
  2018-05-8        melbourne
  2018-05-9        sydney
  2018-05-9        melbourne 
  </code></pre>
  
  <p>I am trying to get the following:</p>
  
  <pre><code>time             syndey_count  melbourne_count 
  2018-05-8        2             1
  2018-05-9        1             1
  </code></pre>
  
  <p>So far I've managed to group by the time then aggregate by the city:</p>
  
  <pre><code>df.groupby('time').agg({'city': 'count'})
  </code></pre>
  
  <p>but that just gives me:</p>
  
  <pre><code>time             city  
  2018-05-8        3             
  2018-05-9        2             
  </code></pre>