Skip to content
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

Merged
merged 2 commits into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updates
  • Loading branch information
TomAugspurger committed May 1, 2018
commit a881c602933585fe3177c39a5f6f5df8e5c8d9a1
2 changes: 1 addition & 1 deletion pandas/io/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _parse_raw_tbody(self, table):

raw_data = []

if len(tbodies) > 0:
if tbodies:
for tbody in tbodies:
raw_data.extend(self._parse_tr(tbody))
else:
Expand Down
9 changes: 4 additions & 5 deletions pandas/tests/io/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,8 @@ def test_empty_tables(self):
assert_framelist_equal(res1, res2)

def test_multiple_tbody(self):
"""
Read all tbody tags within a single table.
"""
# GH-20690
# Read all tbody tags within a single table.
data = '''<table>
<thead>
<tr>
Expand All @@ -421,8 +420,8 @@ def test_multiple_tbody(self):
</tbody>
</table>'''
expected = DataFrame({'A': [1, 3], 'B': [2, 4]})
result = self.read_html(StringIO(data))
tm.assert_frame_equal(result[0], expected)
result = self.read_html(StringIO(data))[0]
tm.assert_frame_equal(result, expected)

def test_header_and_one_column(self):
"""
Expand Down