I have seen many questions in regards to importing multiple csv files into a pandas dataframe. My question is how can you import multiple csv files but ignore the last csv file in your directory? I have had a hard time finding the answer to this.
Also, lets assume that the csv file names are all different which is why the code file is "/*.csv"
any resource would also be greatly appreciated. Thank you!
path =r'C:\DRO\DCL_rawdata_files' # use your path
allFiles = glob.glob(path + "/*.csv")
frame = pd.DataFrame()
list_ = []
for file_ in allFiles:
df = pd.read_csv(file_,index_col=None, header=0)
list_.append(df)
frame = pd.concat(list_)