title: appending data to python dictionary
body: <p>I have used the following code to initialize a dictionary from the list of keys</p>
  
  <pre><code>z=df1[2].value_counts().keys().tolist()
  mydict=dict.fromkeys(z,None)
  </code></pre>
  
  <p>further, I have used </p>
  
  <pre><code>value=df2[2].value_counts().keys().tolist()
  counts=df2[2].value_counts().tolist()
      for j,items in value:
          if mydict.has_key(items):
              mydict.setdefault(items,[]).append(counts[j])
  </code></pre>
  
  <p>it is generating the following error</p>
  
  <blockquote>
    <p>mydict.setdefault(items,[]).append(counts[j])
    AttributeError: 'NoneType' object has no attribute 'append'</p>
  </blockquote>