Pandas read_html跳过表的标题(python)

2024-07-04 10:43:23 发布

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

类为rowheaderdata的所有内容都是使用read_html导入到pandas中的,但是{}类的行不是。在

所以从本质上说,我得到的是所有数据,但不是列标签,这些标签告诉我数据实际上是什么。在

我该怎么解决呢?在

<html xmlns:x="urn:schemas-microsoft-com:office:excel"> <head> <meta name="Generator" content="SAS Software Version 9.3, see www.sas.com"> <meta http-equiv="Content-type" content="charset=windows-1252"> </head> <body> <table class="table"> <colgroup> <col> <col> <col> <col> </colgroup> <colgroup> <col> <col> </colgroup> <thead> <tr> <td class="header" rowspan="2" colspan="4" scope="colgroup">&nbsp;</td> <td class="header" colspan="2" scope="colgroup">SubDistrict</td> </tr> <tr> <td class="header" scope="col">Title1 <br> <br> </td> <td class="header" scope="col">Title2 <br> <br> </td> </tr> </thead> <tbody> <tr> <td class="rowheader" rowspan="12" scope="rowgroup">M1</td> <td class="rowheader" scope="row">1.1</td> <td class="rowheader" scope="row">var1</td> <td class="rowheader" scope="row">TOTAL</td> <td class="data">7</td> <td class="data">7</td> </tr> <tr> etc...


Tags: 数据brcomdatahtmlcol标签tr

热门问题