So i have these CSV files I want to combine as follows:
file1.csv
Date,Time,Unique1,Common
blah,blah,55,92
file2.csv
Date,Time,Unique2,Common
blah,blah,12,25
I want a pandas dataframe where...
Date,Time,Unique1,Unique2,Common (order of columns doesn't matter)
blah,blah,55,12,117
.. where 92+25 is the 117.
I found a post with the exact same title as this one that has the following code sample:
each_df = (pd.read_csv(f) for f in all_files)
full_df = pd.concat(each_df).groupby(level=0).sum()
This does what I need, except that it doesn't carry forward the Date and Time columns. I suppose that's because the sum() doesn't know what to do with it.
I instead get...
Unique1,Unique2,Common
<values as expected>
Please help me to pass through the Date and Time columns. They're supposed to be the exact same in each file so I'm ok to index the data by 'Date' and 'Time' columns.
Thanks in advance.