title: Python / Pandas - Looping through a folder appending files to a data frame if they are in a second data frame
body: <p>I am having a hard time doing something that seems somewhat simple:</p>
  
  <p>Part I
  Creating an empty dataframe to store my data</p>
  
  <p>Part II
  I am using python to iterate through a folder, and look for macro enable excel files</p>
  
  <p>Part III
  This is where I had a hard time -- Ideally I want to  see if 'i' is in the data frame "file_df"'s column "File_Name" then append it to the FileList data frame. Note: this column in the file_df data frame is just a list of the files I actually want to use from the folder.</p>
  
  <pre><code>   import pandas as pd
     import glob 
     import os
  
     #Part I
     FileList = pd.DataFrame(index=file_df.index, columns=['File_Name'])
  
     # Part II
     os.chdir(path)
     for i in glob.glob('*.xlsm'): # gives list of files from the folder
  
     # Part III
     if file_df[file_df['File_Name'].str.contains(i)]:
          FileList.append(i)
  </code></pre>