Appending CSV files, matching unordered columns
Question: Problem: matching columns while appending CSV files

I have 50 .csv files where each column is a word, each row is a time of day
and each file holds all words for one day. They look like this:

    
    
    Date  Time Aword Bword Cword Dword
    Date1 t1   0     1     0     12
    Date1 t2   0     6     3     0
    
    Date  Time Eword Fword Gword Hword Bword
    Date2 t1   0     0     1     0     3
    Date2 t2   2     0     0     19    0
    

I want to append the files so that any columns with the same word (like Bword
in this example) are matched while new words are added in new columns:

    
    
    Date  Time Aword Bword Cword Dword Eword Fword Gword Hword
    Date1 t1   0     1     0     12                       
    Date1 t2   0     6     3     0                        
    Date2 t1         3                 0     0     1     0   
    Date2 t2         0                 2     0     0     19
    

I'm opening the csv files as dataframes to manipulate them and using
dataframe.append the new files are added like this:

    
    
    Date  Time Aword Bword Cword Dword
    Date1 t1   0     1     0     12
    Date1 t2   0     6     3     0
    Date  Time Eword Fword Gword Hword Bword
    Date2 t1   0     0     1     0     3
    Dat2e t2   2     0     0     19    0
    

Is there a different approach which could align matching columns while
appending? ie without iterating through each column and checking for matches.

_Sincere apologies if this question is too vague, I'm new to python and still
struggling to know when I'm thinking un-pythonically and when I'm using the
wrong tools._

EDIT: more information  
1) I'll need to perform this task multiple times, once for each of five
batches of csvs  
2) The files all have 25 rows but have anything from 5 to 294 columns  
3) The order of rows is important Day1(t1, t2...tn) then Day2(t1, t2...tn)  
4) The order of columns is not important


Answer: I think for this kind of thing you might find using the pandas library a bit
easier. Say `filelist` is a list of file names.

    
    
    import pandas as pd
    
    df = pd.concat([pd.read_csv(fl, index_col=[0,1]) for fl in filelist])
    

And you're done! As a side note if you'd like to combine the date and time
columns (depending on their format) you can try

    
    
    df = pd.concat([pd.read_csv(fl, parse_dates=['Date','Time']) for fl in filelist]).drop('Date', axis=1)
    

