Skip to content

Commit 1b612f0

Browse files
committed
changes to fix floats only
1 parent 1061442 commit 1b612f0

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ MultiIndex
619619
I/O
620620
^^^
621621
- Bug in :class:`DataFrame` and :class:`Series` ``repr`` of :py:class:`collections.abc.Mapping`` elements. (:issue:`57915`)
622-
- Bug in :class:`HTMLFormatter._write_cell` to escape regular spaces as `` `` ensuring multiple spaces are preserved in the HTML output. (:issue:`59876`)
623622
- Bug in :meth:`.DataFrame.to_json` when ``"index"`` was a value in the :attr:`DataFrame.column` and :attr:`Index.name` was ``None``. Now, this will fail with a ``ValueError`` (:issue:`58925`)
624623
- Bug in :meth:`DataFrame._repr_html_` pass :func: ``get_option("display.float_format")`` to :class:`DataFrameFormatter`, such that HTML output respects the configured float formatting. (:issue:`59876`)
625624
- Bug in :meth:`DataFrame.from_records` where ``columns`` parameter with numpy structured array was not reordering and filtering out the columns (:issue:`59717`)

pandas/io/formats/html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _write_cell(
190190

191191
if self.escape:
192192
# escape & first to prevent double escaping of &
193-
esc = {"&": r"&amp;", "<": r"&lt;", ">": r"&gt;", " ": "&nbsp;"}
193+
esc = {"&": r"&amp;", "<": r"&lt;", ">": r"&gt;"}
194194
else:
195195
esc = {}
196196

pandas/tests/io/test_info_repr_html.py renamed to pandas/tests/io/formats/test_info_repr_html.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ class Testfloatformat:
77
@pytest.mark.parametrize(
88
"data, format_option, expected_values",
99
[
10-
({"A": [12345.6789]}, "{:12.3f}", "&nbsp;&nbsp;&nbsp;12345.679"),
10+
({"A": [12345.6789]}, "{:12.3f}", "12345.679"),
1111
({"A": [None]}, "{:.3f}", "&nbsp;None"),
1212
({"A": [""]}, "{:.2f}", "&nbsp;"),
1313
({"A": [112345.6789]}, "{:6.3f}", "112345.679"),
14-
({"A": ["foo foo"]}, None, "&nbsp;foo&nbsp;&nbsp;&nbsp;&nbsp;foo"),
15-
({"A": [None]}, None, "&nbsp;None"),
16-
({"A": ["foo foo foo"]}, None, "&nbsp;foo&nbsp;foo&nbsp;foo"),
1714
],
1815
) # test cases
1916
def test_float_formatting_html_output(self, data, format_option, expected_values):

0 commit comments

Comments
 (0)