title: adding new key inside a new key and assigning value in python dictionary
body: <p>I have a dictionary:</p>
  
  <p><code>dic = {'Test': {'cities':5}}</code></p>
  
  <p>it is easy to add a key-value pair inside </p>
  
  <p><code>dic['test']</code></p>
  
  <p>by simply writing</p>
  
  <p><code>dic['Test']['random'] = 1</code> </p>
  
  <p>which gives output like this. </p>
  
  <p><code>{'Test' : {'cities':5, 'random':1}}</code> </p>
  
  <p>but what if I want to add a key:key- value. i.e from above step I want a output like:</p>
  
  <p><code>{'Test' : {'cities':5, 'random':1, 'class':{ section : 5}}}</code></p>
  
  <p>This doesn't works which I thought may work. <code>dic['Test']['class']['section'] = 5</code> </p>
  
  <p>it gives a key error 'class' .</p>
  
  <p>For my specific case I am assigning data frame's row as key in iteration somthing like this.
  <code>dic[df.iloc[i]['column1']][df.iloc[i]['column2']] = df.iloc[i]['column3']</code></p>
  
  <p>where column1 itself is not in the key.
  How to do it, I am using python 2.7</p>