I have several dataframes inn the following format:
time, 2019-01-25
07:00-07:30, 180.22
07:30-08:00, 119.12
08:00-08:30, 11.94
08:30-09:00, 41.62
09:00-09:30, 28.69
09:30-10:00, 119.77
...
(I have many files like the above loaded into dataframes array called frames
).
And I am using Pandas to merge them with the code:
df_merged = reduce(lambda left, right: pd.merge(left, right, on=['time'],
how='outer'), frames).fillna('0.0').set_index('time')
(the code initially came from here)
The merge technically works, however, the final merged dataframe omits the time
column. Does anyone know how to perform the merge as above while still keeping the time
column in df_merged
?