xlsxwriter公式斜率,截距do n

2024-10-03 09:20:14 发布

您现在位置:Python中文网/ 问答频道 /正文

有人知道为什么吗?我用write_formula编写这些公式:

slopeFormula = "=SLOPE(H96:H100;E96:E100)"
ws.write_formula("D105", slopeFormula)
interceptFormula = "=INTERCEPT(H96:H100;E96:E100)"
ws.write_formula("D106", interceptFormula)

我直接在Excel中试过这些公式,效果很好。但当我用Python将它们交织在一起时,工作簿变得不可读:

^{pr2}$

帮忙吗?在


Tags: wsexcelslopewrite公式formulaintercepte100
1条回答
网友
1楼 · 发布于 2024-10-03 09:20:14

问题不在于公式,而在于公式中使用的分隔符。在

来自write_formula()docs

Also, formulas must be written with the US style separator/range operator which is a comma (not semi-colon). Therefore a formula with multiple values should be written as follows:

worksheet.write_formula('A1', '=SUM(1, 2, 3)')  # OK
worksheet.write_formula('A2', '=SUM(1; 2; 3)')  # NO. Error on load.

相关问题 更多 >