【发布时间】:2017-05-30 12:17:16
【问题描述】:
我希望有人可以建议我如何创建只包含第二列文本而不是第一两行或左列的 pandas 数据框。解决方案需要能够处理多个相似的表。
我曾认为pd.read_html(LOTable.prettify(),skiprows=2, flavor='bs4') 从 html 创建一个数据帧列表(跳过 2 行)是一种方式,但最终的数据结构对于这个新手来说太混乱了,无法理解或操作成更简单的结构。
其他人是否有办法使用产生的结构或推荐替代方法来优化数据,以便我最终得到 1 列只包含我需要的文本?
样本表
<table cellpadding="5" cellspacing="0" class="borders" width="100%">
<tr>
<th colspan="2">
Learning Outcomes
</th>
</tr>
<tr>
<td class="info" colspan="2">
On successful completion of this module the learner will be able to:
</td>
</tr>
<tr>
<td style="width:10%;">
LO1
</td>
<td>
Demonstrate an awareness of the important role of Financial Accounting information as an input into the decision making process.
</td>
</tr>
<tr>
<td style="width:10%;">
LO2
</td>
<td>
Display an understanding of the fundamental accounting concepts, principles and conventions that underpin the preparation of Financial statements.
</td>
</tr>
<tr>
<td style="width:10%;">
LO3
</td>
<td>
Understand the various formats in which information in relation to transactions or events is recorded and classified.
</td>
</tr>
<tr>
<td style="width:10%;">
LO4
</td>
<td>
Apply a knowledge of accounting concepts,conventions and techniques such as double entry to the posting of recorded information to the T accounts in the Nominal Ledger.
</td>
</tr>
<tr>
<td style="width:10%;">
LO5
</td>
<td>
Prepare and present the financial statements of a Sole Trader in prescribed format from a Trial Balance accompanies by notes with additional information.
</td>
</tr>
</table>
【问题讨论】:
标签: python pandas python-3.5 bs4