-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read from multiple <tbody> within a <table> #20891
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
refs #20690
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -396,6 +396,34 @@ def test_empty_tables(self): | |
res2 = self.read_html(StringIO(data2)) | ||
assert_framelist_equal(res1, res2) | ||
|
||
def test_multiple_tbody(self): | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add the issue number here, you can use use |
||
Read all tbody tags within a single table. | ||
""" | ||
data = '''<table> | ||
<thead> | ||
<tr> | ||
<th>A</th> | ||
<th>B</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>1</td> | ||
<td>2</td> | ||
</tr> | ||
</tbody> | ||
<tbody> | ||
<tr> | ||
<td>3</td> | ||
<td>4</td> | ||
</tr> | ||
</tbody> | ||
</table>''' | ||
expected = DataFrame({'A': [1, 3], 'B': [2, 4]}) | ||
result = self.read_html(StringIO(data)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move the indexer to this line and make the subsequent line just |
||
tm.assert_frame_equal(result[0], expected) | ||
|
||
def test_header_and_one_column(self): | ||
""" | ||
Don't fail with bs4 when there is a header and only one column | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For PEP8 compliance use the boolean-ness of the sequence, so just
if tbodies: