In a folder,there is multiple excel files with initial unwanted report and the unwanted footer also. Unwanted number of header rows are varying in fie to file. I want to create one dataframe by accessing with folder.
Here i attached sample examples.
This is what i develop so far and want specific method to clean all excel files.
cd = os.path.dirname(os.path.abspath("D:project"))
i = 0
dfList = []
for root, dirs, files in os.walk(cd):
for fname in files:
if re.match("^.*.xlsx$", fname):
data = pd.read_excel(os.path.join(root, fname)) # want method to clean and read all files at once not file by file
dfList.append(data)
i += 1
df = pd.concat(dfList)
Thanks in advance for your help.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…