import pandas as pd
import os
path = r"D:\yang\hebingexcel"
'''创建源数据数组df,通地for循环遍历文件夹下excel名字,并逐个生成数据,最后添加进df数组'''
df = []
for i in os.listdir(path):
name = os.path.join(path,i) #路径+单个文件夹名 为str类型
single = pd.read_excel(name)
df.append(single)
df = pd.concat(df,ignore_index=True)
pandas合并同一个文件夹内excel文件
最新推荐文章于 2024-04-18 17:45:00 发布