I need to create a dataframe to push to database containing the last 5 lines (all columns) of all CSV files in directory.
So far here is what I have, but it is not adding Data and just says Empty DataFrame
#blank Dataframe
cols = ['ticker', 'date', 'open', 'high', 'low', 'close', 'volume', 'time']
insert_list = pd.DataFrame(columns = cols)
#select csvs to merge
listdrs = os.listdir(string)
listdrs_path = [ string + x for x in listdrs]
#loop through csv's
for file_path in listdrs_path:
data = pd.read_csv(file_path, index_col=0)
insert_list.append(data.tail(5))
#save list as new csv
insert_list.to_csv('compressed_update.csv')