import pandas as pd
import glob
import os
os.chdir("C:/Users/DONPECH/Desktop/PROJECTS/AIRLINE RESEARCH/RESEARCH/DATASET/flight")
# setting the path for joining multiple files
files = os.path.join("C:/Users/DONPECH/Desktop/PROJECTS/AIRLINE RESEARCH/RESEARCH/DATASET/flight", "On_Time_On_Time_Performance_2015_*.csv")
# list of merged files returned
files = glob.glob(files)
print("Resultant CSV after joining all CSV files at a particular location...");
# joining files with concat and read_csv
df = pd.concat(map(pd.read_csv, files),ignore_index=True)
#export DataFrame to CSV file
df.to_csv(r'C:UsersDONPECHDesktopPROJECTSAIRLINE RESEARCHRESEARCHDATASETflightflights.csv', index=False)
print(df)