我对 python 有点陌生,目前正在开发一个项目,并在这行代码中遇到此错误。
g1_coll[obstacle==0]=tau*(g1+g2-g3+g4)
g2_coll[obstacle==0]=tau*(g1+g2+g3-g4)
g3_coll[obstacle==0]=tau*(-g1+g2+g3+g4)
g4_coll[obstacle==0]=tau*(g1-g2+g3+g4)
Run Code Online (Sandbox Code Playgroud)
谁能帮助我理解这一点?
假设我们有 2 个单元格,一个包含零,另一个为空,请参A2:A3见图中的范围:
如果它们通过了 a ,我们会得到两个零,请参见下图所示的inFILTER输出。当我们应用到存储先前结果的范围时,输出是单独的 0(参见 中的结果)。但是组合不会将这些零视为彼此相等,请参阅in的输出:FILTER(A2:A3, TRUE)B2:B3UNIQUEC2UNIQUE(FILTER(...))UNIQUE(FILTER(A2:A3,TRUE))D2:D3
这是为什么?我们能否抑制这种行为并仅得到一个零作为组合结果?
ps 我使用 Office 365,Excel 版本 2108
因任一错误而遇到麻烦;writer.book=book AttributeError: can't set attribute 'book'或者BadZipFile
对于没有给出 badzipfile 错误的代码,我首先放置了写入 excel 文件的代码行,dataOutput=pd.DataFrame(dictDataOutput,index=[0])
但是,即使我无法摆脱,writer.book = book AttributeError: can't set attribute 'book'正如其中一个答案所示,我需要将 openpyxl 返回到以前的版本,或者使用 CSV 文件而不是 excel。我认为这不是解决方案。应该有我无法进入的解决方案
dataOutput=pd.DataFrame(dictDataOutput,index=[0])
dataOutput.to_excel('output.xlsx') 'output.xlsm'
book = load_workbook('output.xlsx') 'output.xlsm'
writer = pd.ExcelWriter('output.xlsx')OR'output.xlsm'#,engine='openpyxl',mode='a',if_sheet_exists='overlay')
writer.book = book
writer.sheets = {ws.title: ws for ws in book.worksheets}
for sheetname in writer.sheets:
dataOutput.to_excel(writer,sheet_name=sheetname, startrow=writer.sheets[sheetname].max_row, index = False,header= False)
writer.save()
Run Code Online (Sandbox Code Playgroud)
我在此处输入链接描述中寻找答案,并在此处输入链接描述中属性错误的详细解决方案中寻找答案
---我尝试了另一种方法
with pd.ExcelWriter('output.xlsx', mode='a',if_sheet_exists='overlay') as writer:
dataOutput.to_excel(writer, sheet_name='Sheet1')
writer.save()
Run Code Online (Sandbox Code Playgroud)
但是这次又报错了
FutureWarning: save is not part …Run Code Online (Sandbox Code Playgroud) 我想使用 pip(版本 1.35)安装 grpcio。\n但是我收到此错误:
\nnote: This error originates from a subprocess, and is likely not a problem with pip.\nerror: legacy-install-failure\n\n\xc3\x97 Encountered error while trying to install package.\n\xe2\x95\xb0\xe2\x94\x80> grpcio\nRun Code Online (Sandbox Code Playgroud)\n我尝试安装 python-dev 或wheel,但没有成功。
\n我的Python版本= 3.10
\n乌班图 = 22.04
\n