|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- # coding:utf-8
- import os
- import pandas as pd
- import time
- t1 = time.time()
- l = []
- n = 0
- for file in os.walk(r'E:\a'):
- for table in file[2]:
- path = file[0] + '/' + table
- data = pd.read_excel(path, header=0, encoding='utf-8', engine='python')
- n = n + 1
- l.append(data)
- print('第' + str(n) + '个表格已提取')
- date_result = pd.concat(l)
- date_result.to_excel(r'E:\a\result.excel', index=0)
- t2 = time.time()
- t2 = t2 - t1
- t = round(t2, 2)
- print('用时' + str(t) + '秒')
- print('完成')
复制代码
出错,
- C:\Users\beluc\AppData\Local\Programs\Python\Python38\python.exe E:/_Python_/删除/鹰紫-合并excel-confired.py
- Traceback (most recent call last):
- File "E:/_Python_/删除/鹰紫-合并excel-confired.py", line 13, in <module>
- data = pd.read_excel(path, header=0, encoding='utf-8', engine='python')
- File "C:\Users\beluc\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\io\excel\_base.py", line 304, in read_excel
- io = ExcelFile(io, engine=engine)
- File "C:\Users\beluc\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\io\excel\_base.py", line 813, in __init__
- raise ValueError(f"Unknown engine: {engine}")
- ValueError: Unknown engine: python
复制代码
|
|