title: Appending missing values in list of dictionaries
body: <p>I have a list which looks like this:</p>
  
  <pre><code>[
  {
      "timeline": "2014-10", 
      "total_prescriptions": 17
  }, 
  {
      "timeline": "2014-11", 
      "total_prescriptions": 14
  }, 
  {
      "timeline": "2014-12", 
      "total_prescriptions": 8
  {
      "timeline": "2015-1", 
      "total_prescriptions": 4
  }, 
  {
      "timeline": "2015-3", 
      "total_prescriptions": 10
  }, 
  {
      "timeline": "2015-4", 
      "total_prescriptions": 3
  } 
  ]
  </code></pre>
  
  <p>This is basically the output of a raw SQL query in Django which does a count of the total_prescriptions per months and arranges the data in ascending order.However,the nature of MYSQL count is that it does not return a 0 for null values.Hence,the month of February is totally skipped rather than having an entry with total_prescriptions equal to 0.</p>
  
  <p>I plan to iterate through the list in python and manually add total_prescriptions=0 for all the missing months so that the output looks like this:</p>
  
  <pre><code>[
  {
      "timeline": "2014-10", 
      "total_prescriptions": 17
  }, 
  {
      "timeline": "2014-11", 
      "total_prescriptions": 14
  }, 
  {
      "timeline": "2014-12", 
      "total_prescriptions": 8
  {
      "timeline": "2015-1", 
      "total_prescriptions": 4
  }, 
  {
      "timeline": "2015-2", 
      "total_prescriptions": 0
  }, 
  {
      "timeline": "2015-3", 
      "total_prescriptions": 10
  }, 
  {
      "timeline": "2015-4", 
      "total_prescriptions": 3
  } 
  ]
  </code></pre>
  
  <p>How would I go about doing that ?</p>