我有一个带有数据表的word文件(.docx),我正在尝试使用该表创建一个pandas数据框,我使用了docx和pandas模块.但我无法创建数据框.
from docx import Document
document = Document('req.docx')
for table in document.tables:
for row in table.rows:
for cell in row.cells:
print (cell.text)
Run Code Online (Sandbox Code Playgroud)
并尝试将表读为df pd.read_table("path of the file")
我可以逐个单元格读取数据,但我想读取整个表格或任何特定的列.提前致谢