title: Running python code on multiple files in folder and writing them to separate files
body: <p>I am working on a code to run a script on multiple files in a folder.  I am able to run the code on each file however it is only saving to one output file then rewriting over that file.  How can I get this code to save the output to separate files?  Preferably with a similar name to each original file.  This is what I have thus far.</p>
  
  <pre><code>import os, re
  import pandas as pd
  directory = os.listdir('C:/Users/user/Desktop/NOV')
  os.chdir('C:/Users/user/Desktop/NOV')
  
  for file in directory:
      df = pd.read_csv(file, index_col="DateTime", parse_dates=True)
      df = df.resample('1min').mean()
      df = df.reindex(pd.date_range(df.index.min(), df.index.max(), freq="1min"))
      df.to_csv("newfile.csv", na_rep='NaN')
  </code></pre>