title: Best way to aggregate a simple dict in Python
body: <p>My problem is simple: I have a list of dicts, and I want to make a count aggregation of this into a new dictionary, on a particular key. Just like <a href="https://stackoverflow.com/questions/17873046/best-way-to-aggregate-a-list-of-items-and-collect-totals">this</a>, but in Python.</p>
  
  <h2>Original data</h2>
  
  <pre><code>mylist = [
      {'date': '16-01-2016', 'name': 'A'},
      {'date': '16-01-2016', 'name': 'B'},
      {'date': '17-01-2016', 'name': 'C'},
      {'date': '17-01-2016', 'name': 'D'},
      {'date': '17-01-2016', 'name': 'E'},
      {'date': '18-01-2016', 'name': 'F'},
  ]
  </code></pre>
  
  <h2>Result</h2>
  
  <pre><code>{'17-01-2016': 3, '16-01-2016': 2, '18-01-2016': 1}
  </code></pre>
  
  <h2>How to?</h2>
  
  <p>What is the best solution to achieve this? I would like to do it a more beautiful and pythonic way than that ugly piece of code:</p>
  
  <pre><code>result = {}
  for item in mylist:
      if not item['date'] in result:
          result[item['date']] = 1
      else:
          result[item['date']] += 1
  </code></pre>
  
  <p>Many thanks for considering my request!</p>