I am trying to merge around 15+ excel files into one huge file. There is also time mismatches and I want to combine some of the time frames into one. For example, if you have 10:15am - 10:30am and value A associated with this time in one sheet, and in another sheet you have 10am - 11am and the associated "balance" value B, then in the merge you can have 10:15am-10:30am values A and B, as the B falls into that time as well.
This is what I have so far which helps to merge the excel files into one. But now I am having trouble in matching the timeframes, please help! Thanks!
import os
import pandas as pd
path = os.getcwd()
files = os.listdir(path)
files
path = os.getcwd()
files = os.listdir(path)
files_csv = [f for f in files if f.endswith('.csv')]
dfs = []
for f in files_csv:
data = pd.read_csv(f)
dfs.append(data)
df = pd.concat(dfs, ignore_index=True)
print(df)
To solve your problem, you need to ensure that the CSV files are in your current working directory. Once you have the CSV files, you can use the following code to merge them and align the data based on overlapping time intervals
Replace 'start_time' and 'end_time' with the actual column names in your CSV files that represent the start and end times. Feel free to ask more questions, i hope this helps </> Code By Ipeleng Floyd Bela