I would like to read just csv last 7 days createds csv files from a directory into pandas and concatenate them into one big DataFrame. I have not been able to figure it out though. Here is what I have so far:
Edit: I'm trying to filter by the creation date of csv file, not by any column in csv.
from datetime import datetime, timedelta
import pandas as pd
import glob
fileday = datetime.now() - timedelta(7)
fileday = datetime.strftime(fileday, '%Y%m%d')
path = r'C:\DRO\DCL_rawdata_files' # use your path
all_files = glob.glob(path + "/*.csv")
li = []
for filename in all_files:
df = pd.read_csv(filename, index_col=None, header=0)
li.append(df)
frame = pd.concat(li, axis=0, ignore_index=True)