title: How do I match similar names to a given row if they appear in one year and not the next and appear again?
body: <p>Actual Question (couldn't add to title because it's too long): I have facility names in a list of list, where each list is for a corresponding year. I want to create a data frame, with each row containing a unique facility name. The problem is, some years a facility name might appear, and in the next year, it could be absent and in the following year, it could appear again and so forth. Also there are facilities that don't appear until much later. I've been trying to create a data frame that matches unique facility names to a row (where they first appear) but I've been unsuccessful. </p>
  
  <p>Ideal:</p>
  
  <pre class="lang-py prettyprint-override"><code>Headers  = ['1999','2000','2001','2002','2003']
  file1999 = ['Factory_A']
  file2000 = ['Factory_A','Factory_B']
  file2001 = ['Factory_B']
  file2002 = ['Factory_A','Factory_C']
  file2003 = ['Factory_A','Factory_B','Factory_C']
  
  1999          2000           2001       2002       2003
  
  Factory_A     Factory_A      NA         Factory_A  Factory_A
  
  NA            Factory_B      Factory_B  NA         Factory_B
  
  NA            NA             NA         Factory_C  Factory_C
  </code></pre>
  
  <p>I thought I could just merge the the lists using a loop, but this didn't garner the result I need. </p>
  
  <pre class="lang-py prettyprint-override"><code>
  df = pd.DataFrame({'Factories':['NaN']})
  for i, j in zip((files), (Headers)):
      new_DF = pd.DataFrame({'Factories':i})
      df = df.merge(new_DF, on = ['Factories'],how='right')
  
  # I got this with 'right'
      Factories
  0   Factory_A
  1   Factory_C
  2   Factory_B
  
  # I then tried to append a new column
  
  df = pd.DataFrame({'Factories':['NaN']})
  for i, j in zip(files, Headers):
      new_DF = pd.DataFrame({'Factories':i})
      df[j] = new_DF
  
  # But I got this result instead:
      Factories   1999    2000    2001    2002    2003
  0   NaN     Factory_A   Factory_A   Factory_B   Factory_A   Factory_A
  
  </code></pre>