title: KeyError 43L in python
body: <p>I want to assign a list for dictionary inside another dictionary but i get a key error
  you can find the file here
  <a href="https://www.dropbox.com/s/9n35b41rzuxjkk8/plan1.txt?dl=0" rel="nofollow">https://www.dropbox.com/s/9n35b41rzuxjkk8/plan1.txt?dl=0</a></p>
  
  <pre><code>Code, Title, Lec, Lab, Cr, Prereq, Year, Semester
  
  ARAB110 ,  Arabic Language Skills I ,  3 ,  0 , 3,  - ,  1 ,  1 
  CHEMY101 ,  General Chemistry I ,  3 ,  3 , 4,  - ,  2 ,  2 
  ENGL154 ,  Language Development I ,  3 ,  0 , 3,  - ,  1 ,  1 
  ENGL155 ,  Language Development II ,  3 ,  0 , 3,  ENGL154 ,  1 ,  2 
  ENGL219 ,  Technical Report Writing ,  3 ,  0 , 3,  ENGL155 ,  2 ,  1 
  </code></pre>
  
  <p>i want to create a dict for every year and inside every year a dictonary of every semester contains a list of all codes in this semester </p>
  
  <pre><code>curri = read_csv('senior_data/plan1.txt')
  curri = curri.sort([' Year',' Semester '],ascending=[1,1]) 
  
  cur = {}
  cur['1']={}
  cur['2']={}
  cur['3']={}
  cur['4']={}
  
  cur['1']['1'] = {}
  cur['1']['2'] = {}
  cur['2']['1'] = {}
  cur['2']['2'] = {}
  cur['3']['1'] = {}
  cur['3']['2'] = {}
  cur['3']['3'] = {}
  cur['4']['1'] = {}
  cur['4']['2'] = {}
  
  
  i=0
  c_list = []
  for xxx in cur:
      for y in cur[xxx]:
          print (xxx+" "+y)
          for row in curri.iterrows():
              if(str(curri[' Year'][i]) == xxx and str(curri[' Semester '][i] == y)):   
                  print (xxx+":"+y+ curri['Code'][i])
                  c_list.append(curri['Code'][i])
              i=i+1
              cur[xxx][y] = c_list
              c_list = []
  </code></pre>
  
  <p>when I remove the third loop it's work fine!</p>
  
  <p>this is the output:</p>
  
  <pre><code>1 1
  1:1 ARAB110 
  1:1 ENGL154 
  1:1 ENGL155 
  1:1 ISLM101 
  1:1 ITCS101 
  1:1 ITCS102 
  1:1 MATHS101 
  1:1 MATHS102 
  1:1 PHYCS101 
  1:1 PHYCS102 
  1 2
  </code></pre>
  
  <p>the error is </p>
  
  <pre><code>KeyError: 42L
  
  ---&gt; 24             if(str(curri[' Year'][i]) == xxx and str(curri[' Semester ']
  </code></pre>