python-3.x - 如何处理 book.parse(sheet) 上的内存错误
问题描述
在 book.parse(sheet) 上出现内存错误
读取目录中的一些文件后出现内存错误book.parse(sheet)
for filename in os.listdir(cwd):
if filename.endswith('.xlsx') and not filename.startswith(('1Data')):
book = pd.ExcelFile(filename)
print(filename)
for sheet in book.sheet_names:
df = book.parse(sheet) #how can i handle this
if 'comp' in df.columns:
df['comp1']=df['comp']
print("For "+filename+"\n")
book2=df.pivot_table(values='comp1',index=['pe','id'], columns='comp', aggfunc='count',margins=True)
解决方案
推荐阅读
- c# - ASP.NET Core WebApi Add-Migration Entity Framework Core
- django - 如果另一个创建不成功的 django 则阻止用户创建
- r - 如何运行 rmarkdown 以创建具有不同参数的多个 html?
- vb.net - SSRS - 从 VB.NET 代码发送到 SSRS 报告的参数未被识别,VB.NET 和 SSRS 在连接字符串中有不同的提供程序
- google-api - 使用受限范围时的 Google 安全评估豁免
- python - Chrome 在配置文件路径中本地存储 cookie 太晚了
- html - 在不同大小的屏幕上更改文本
- javascript - 如何在使用浏览器获取源代码视图时隐藏 HTML 源代码中的链接?
- javascript - 使用行 ID 访问不同表中的行
- autohotkey - AutoHotkey - 仅在一个应用程序中捕获热键组合 - 不要阻止其他应用程序使用相同的组合