小编tg1*_*110的帖子

使用 python-docx 将表格中的单元格设为粗体

下面的代码片段基本上创建了一个表格,其中包含新 Word 文档中所需的行数和列数,即 2 列和 14 行。然后相应地将内容添加到行和列。

from docx import Document
newDoc=Document()
newDoc.add_heading ('GIS Request Form')
newDoc.add_paragraph()

#inserting a table and the header and value objects to the table
 table=newDoc.add_table(rows=14,cols=2)
 table.style='Table Grid'
 table.autofit=False
 table.columns[0].width=2500000
 table.columns[1].width=3500000

 #inserting contents into table cells
 for i in range(0,14):
   row=table.rows[i]
   row.cells[0].text=reqdheaderList[i]
   row.cells[1].text=reqdvalueList[i]
Run Code Online (Sandbox Code Playgroud)

我一直试图将第 1 列中所有内容的内容加粗,但它不起作用。

  #inserting contents into table cells
   for i in range(0,14):
     row=table.rows[i]
     row.cells[0].text=reqdheaderList[i]
     row.cells[0].paragraphs[0].add_run(line[0]).bold=True
     row.cells[1].text=reqdvalueList[i]
Run Code Online (Sandbox Code Playgroud)

帮助?

python docx python-docx

5
推荐指数
2
解决办法
7760
查看次数

xtest 和 ytest 详细信息在 R 中的 randomForest() 中

据我了解,RF 有内部袋内和袋外验证技术,其中 1/3 的数据被保留(袋外),2/3 的数据用于训练 RF 模型。

我的问题是,如果上述情况属实,为什么需要对数据集进行分区并因此使用 xtest 和 ytest 参数。

请从回归而不是分类的角度考虑这个问题。

r random-forest cross-validation

5
推荐指数
0
解决办法
275
查看次数

标签 统计

cross-validation ×1

docx ×1

python ×1

python-docx ×1

r ×1

random-forest ×1