I've tried using numpy.concatonate as this post suggests
The files I'm working on originally look like this.
>>> df = pd.read_html(file)
>>> df.head()
0 1 2
0 Id Date Reason
1 161 04-Mar-2019 Cancelled
2 843 04-Mar-2019 Cancelled
3 042 04-Mar-2019 Cancelled
4 247 04-Mar-2019 Cancelled
This is my code, the csv file it spits out still has the column names where the files have been joined.
files = sorted(glob.glob(path + "Export*"+ extension))
all_data = []
if len(files) == 1: # check if there's only 1 file
df = pd.read_html(files[0])[0]
df.to_csv(path + filename + ".csv", index=False, header=False)
first = files.pop(-1) # order the files
files.insert(0, first)
for file in files:
df = pd.read_html(file)[0]
all_data.append(df.values)
df = pd.DataFrame(np.concatenate(all_data), columns=pd.read_html(first)[0].columns)
df.to_csv(path + filename + ".csv", index=False, header=False)