title: How to use aggregate with condition in pandas?
body: <p>I have a dataframe.
  Following code works </p>
  
  <pre><code>stat = working_data.groupby(by=['url', 'bucket_id'], 
                              as_index=False).agg({'delta': 'max','id': 'count'})
  </code></pre>
  
  <p>Now i need to count ids with different statuses. I have "DOWNLOADED", "NOT_DOWNLOADED" and "DOWNLOADING" for the status.</p>
  
  <p>I would like to have <code>df</code> with columns <code>bucket_id</code>, <code>max</code>, <code>downloaded</code> (how many have "DOWNLOADED" status) , <code>not_downloaded</code> (how many have "NOT_DOWNLOADED" status) , <code>downloading</code> (how many have "DOWNLOADING" status). How to make it?</p>
  
  <p>Input I have:
   <img src="https://i.stack.imgur.com/eLzeE.png" alt="enter image description here">.</p>
  
  <p>Output i have:
   <img src="https://i.stack.imgur.com/2AUv1.png" alt="enter image description here"></p>
  
  <p>As you can see count isn't devided by status. But i want to know that there are x downloaded, y not_downloaded, z downloading for each bucket_id  bucket_id (so they should be in separate columns, but info for one bucket_id should be in one row) </p>