title: Efficiently Iterating over dictionary list values by skipping missing values Python 3
body: <p>I have a pandas dataframe</p>
  
  <pre><code>import pandas as pd
  
  df=pd.DataFrame({'Location': [ 'NY', 'SF', 'NY', 'NY', 'SF', 'SF', 'TX', 'TX', 'TX', 'DC'],
                   'Class': ['H','L','H','L','L','H', 'H','L','L','M'],
                   'Address': ['12 Silver','10 Fak','12 Silver','1 North','10 Fak','2 Fake', '1 Red','1 Dog','2 Fake','1 White'],
                   'Score':['4','5','3','2','1','5','4','3','2','1',]})
  </code></pre>
  
  <p>And I want to add 2 tags which I stored in dictionaries. Note that the second dictionary does not include key 'A'</p>
  
  <pre><code>df['Tag1'] =''
  df['Tag2'] =''
  
  tagset1 = {'A':['NY|SF'],
            'B':['DC'],
            'C':['TX'],
            }
  for key in tagset1:
      df.loc[df.Location.str.contains(tagset1[key][0]) &amp; (df.Tag1 == ''),'Tag1'] = key
  
  
  tagset2= {'B':['H|M'],
            'C':['L'],
            }
  for key in tagset2:
      df.loc[df.Class.str.contains(tagset2[key][0]) &amp; (df.Tag2 == ''),'Tag2'] = key
  
  print (df)
  </code></pre>
  
  <p>If I want to combine the both dictionaries to make the code more readable and efficient should I fill in the spot for A in <code>newtagset['A'][1]</code> with <code>''</code> or is there another way to make the iterator ignore or skip position <code>newtagset['A'][1]</code> when iterating over the position in the list?</p>
  
  <pre><code>newtagset = {'A':['NY|SF', '',],
            'B':['DC','H|M',],
            'C':['TX','L',],
            }
  
  
  for key in newtagset:
      df.loc[df.Location.str.contains(newtagset[key][0]) &amp; (df.Tag1 == ''),'Tag1'] = key
  
  for key in newtagset:
      df.loc[df.Class.str.contains(newtagset[key][1]) &amp; (df.Tag2 == ''),'Tag2'] = key
  
  print (df)
  </code></pre>
  
  <p>Most solutions I found uses itertools <a href="https://stackoverflow.com/questions/22295901/skip-multiple-iterations-in-loop-python">Skip multiple iterations in loop python</a> is this the only way?</p>