title: Dictionary in for loop not working as I expected to be
body: <p>I am trying to create a dictionary using a for loop. However, not sure why, the item in bx3 and box is about 200+ but when I display dicts, only 22 items are generated. Anyone can explain what I did wrong? I ensure the length of items is considered in the for loop before creating the dictionary but the results are odd. Any help will be appreciated!</p>
  <p><a href="https://i.stack.imgur.com/IzsD4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IzsD4.png" alt="enter image description here" /></a></p>
  <pre><code>import pandas as pd
  
  import yfinance as yf
  import pandas_ta as ta
  
  char2 = ['a','b','c','d','e','f','g','h','i','j','k','l',
                 'm','n','o','p','q','r','s','t','u','v','w','x','y','z']
  
  rep2 = [1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8]
    
      
  x=[4,9]
  
  x2= list(dict.fromkeys(x))
  lx=[]
  
  for n1,v1 in enumerate(rep2):
      for j in x2:
          if v1==j:
              lx.append((char2[n1]).upper())
  
  print(lx)
  print('')
  
  #read_asx_ticker
  
  ASXLIST_FILE = 'https://www.asx.com.au/asx/research/ASXListedCompanies.csv'
  
  df =pd.read_csv(ASXLIST_FILE,header=1)
  codelist = df['ASX code'].values
  codesector = df['GICS industry group'].values
  
  dd=lx
  
  box=[]
  box2=[]
  bx=[]
  bx2=[]
  bx3=[]
  for i in range(0,len(codesector)):
      if 'Not' not in codesector[i]:
          if len(set(dd).intersection(codelist[i]))&gt;2:
              box.append(codelist[i])
              bx2.append(codesector[i])
              
          elif len(set(dd).intersection(codelist[i]))==2:
              box2.append(codelist[i])
              bx3.append(codesector[i])
              bx.append(codelist[i]+'/'+codesector[i])
  
  
  dicts={}
  
  for i in range(0,len(bx3)):
      dicts[bx3[i]]= box2[i]
  </code></pre>