title: Repeat panda data frame processes for multiple text files?
body: <p>I wish to read a large number of text files, process the text files using pandas data frames and then output a new text file for each input file.</p>
  <p>My code works when I process a single text file but not when I try and loop through multiple text files.</p>
  <p>My code for a single file is:</p>
  <pre><code>df = pd.read_csv('name.txt',sep='\s+',skiprows=22, header=None, names=header_list,)
  df['offset'] = df.iloc[0,1]
  df['offset_removed'] = df['mufluor']-df['offset']
  df.to_csv('name_2.txt',index=None, sep=' ', mode='a')
  </code></pre>
  <p>I have been trying to use this code to cycle through multiple files:</p>
  <pre><code>all_files=glob.glob(os.path.join(path,&quot;*.txt&quot;))
  for file in all_files:
      file_name = os.path.split(file)[1]
      header_list=[&quot;energy&quot;,&quot;mufluor&quot;,&quot;io&quot;,&quot;ifluor_DT&quot;,&quot;ifluor_raw&quot;,&quot;counttime&quot;,&quot;itrans&quot;,&quot;irefer&quot;]
      df = pd.read_csv(file_name,sep='\s+',skiprows=22, header=None, names=header_list,)
      df['offset'] = df.iloc[0,1]
      df['offset_removed'] = df['mufluor']-df['offset']
  </code></pre>
  <p>But this doesn't seem to work as the values in my data frames now seem to be strings? Rather than floats...I am not sure why the type of data in my data frame has changed?</p>