I am reading multiple files using pandas and need to save each file with the original filename_corrected. How do you rename the output file with it's original filename + a prefix or number?
import pandas as pd
import glob
import os
#Read all files in using pandas
path = r'J:\Temp\\'
all_files = glob.glob(path + "/*.97o")
for filename in all_files:
df = pd.read_csv (filename)
df = df.replace(to_replace ='1997 7 23 ', value = '2019 5 23 ', regex = True)
df = df.replace(to_replace ='97 7 23', value = '19 5 23', regex = True)
df.to_csv('J:\Temp\94512040_corrected.97o', index=False)
Output file should be called: filename_corrected.97o