2 回答
TA贡献1847条经验 获得超11个赞
您可以尝试以下操作:
import glob
import pandas as pd
filenames = glob.glob( "/*.xlsx")
d = []
not_req_sheets = [0]
for filename in filenames:
xl = pd.ExcelFile(filename)
for sheet_name in xl.sheet_names:
if sheet_name not in not_req_sheets:
df = xl.parse(sheet_name, index_col=None)
d.append(df)
data = pd.concat(d, axis=0, ignore_index=True)
TA贡献1860条经验 获得超9个赞
我会这样做:
filenames = glob.glob( "/*.xlsx")
d = []
for filename in filenames:
df = pd.read_excel(filename, index_col=None, sheet_name=None) # Load All Sheets
df = df[1:] # Only need second to last sheets
d.append(df)
data = pd.concat(d, axis=0, ignore_index=True)
添加回答
举报