Skip to content

Commit 0982da9

Browse files
committed
Fix ci
1 parent 6eeb058 commit 0982da9

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ I/O
557557
- Bug in :meth:`HDFStore.get` was failing to save data of dtype datetime64[s] correctly (:issue:`59004`)
558558
- Bug in :meth:`read_csv` raising ``TypeError`` when ``index_col`` is specified and ``na_values`` is a dict containing the key ``None``. (:issue:`57547`)
559559
- Bug in :meth:`read_csv` raising ``TypeError`` when ``nrows`` and ``iterator`` are specified without specifying a ``chunksize``. (:issue:`59079`)
560+
- Bug in :meth:`read_html` would return an incorrect result when parsing a table with a space character in a ``<td>`` tag. (:issue:`12345`)
560561
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
561562

562563
Period

pandas/io/html.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,8 @@ def read_html(
11491149
{storage_options}
11501150
11511151
.. versionadded:: 2.1.0
1152-
1152+
1153+
11531154
skip_blank_lines: bool, default True
11541155
Whether lines containing only spaces should be skipped or not.
11551156
@@ -1228,5 +1229,5 @@ def read_html(
12281229
extract_links=extract_links,
12291230
dtype_backend=dtype_backend,
12301231
storage_options=storage_options,
1231-
skip_blank_lines=skip_blank_lines
1232+
skip_blank_lines=skip_blank_lines,
12321233
)

pandas/tests/io/test_html.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,32 @@ def test_preserve_empty_rows(self, flavor_read_html):
12421242

12431243
tm.assert_frame_equal(result, expected)
12441244

1245+
def test_preserve_rows_with_spaces(self, flavor_read_html):
1246+
result = flavor_read_html(
1247+
StringIO(
1248+
"""
1249+
<table>
1250+
<tr>
1251+
<th>A</th>
1252+
<th>B</th>
1253+
</tr>
1254+
<tr>
1255+
<td>a</td>
1256+
<td>b</td>
1257+
</tr>
1258+
<tr>
1259+
<td> </td>
1260+
<td> </td>
1261+
</tr>
1262+
</table>
1263+
"""
1264+
),
1265+
skip_blank_lines=False,
1266+
)[0]
1267+
expected = DataFrame(data=[["a", "b"], [" ", " "]], columns=["A", "B"])
1268+
1269+
tm.assert_frame_equal(result, expected)
1270+
12451271
def test_ignore_empty_rows_when_inferring_header(self, flavor_read_html):
12461272
result = flavor_read_html(
12471273
StringIO(

0 commit comments

Comments
 (0)