Skip to content

Commit e1cf343

Browse files
committed
Revert "fix linting"
This reverts commit 1061442.
1 parent 1061442 commit e1cf343

File tree

3 files changed

+27
-30
lines changed

3 files changed

+27
-30
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,7 @@ 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`)
624-
- 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`)
625623
- Bug in :meth:`DataFrame.from_records` where ``columns`` parameter with numpy structured array was not reordering and filtering out the columns (:issue:`59717`)
626624
- Bug in :meth:`DataFrame.to_dict` raises unnecessary ``UserWarning`` when columns are not unique and ``orient='tight'``. (:issue:`58281`)
627625
- Bug in :meth:`DataFrame.to_excel` when writing empty :class:`DataFrame` with :class:`MultiIndex` on both axes (:issue:`57696`)
@@ -638,6 +636,8 @@ I/O
638636
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
639637
- Bug in :meth:`read_stata` where extreme value integers were incorrectly interpreted as missing for format versions 111 and prior (:issue:`58130`)
640638
- Bug in :meth:`read_stata` where the missing code for double was not recognised for format versions 105 and prior (:issue:`58149`)
639+
- 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`)
640+
- Bug in :class:`HTMLFormatter._write_cell` to escape regular spaces as ` `, ensuring multiple spaces are preserved in the HTML output (:issue:`59876`).
641641

642642
Period
643643
^^^^^^

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;"," ":"&nbsp;"}
194194
else:
195195
esc = {}
196196

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
11
import pytest
2-
32
import pandas as pd
43

54

65
class Testfloatformat:
7-
@pytest.mark.parametrize(
8-
"data, format_option, expected_values",
9-
[
10-
({"A": [12345.6789]}, "{:12.3f}", "&nbsp;&nbsp;&nbsp;12345.679"),
11-
({"A": [None]}, "{:.3f}", "&nbsp;None"),
12-
({"A": [""]}, "{:.2f}", "&nbsp;"),
13-
({"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"),
17-
],
18-
) # test cases
19-
def test_float_formatting_html_output(self, data, format_option, expected_values):
20-
# set float format, avoid for string checks
21-
if format_option is not None:
22-
pd.set_option("display.float_format", format_option.format)
23-
24-
# create dataframe
25-
df = pd.DataFrame(data)
6+
@pytest.mark.parametrize("data, format_option, expected_values", [
7+
({"A": [12345.6789]}, "{:12.3f}", "&nbsp;&nbsp;&nbsp;12345.679"),
8+
({"A": [None]}, "{:.3f}", "&nbsp;None"),
9+
({"A": [""]}, "{:.2f}", "&nbsp;"),
10+
({"A": [112345.6789]}, "{:6.3f}", "112345.679"),
11+
({"A": ["foo foo"]}, None, "&nbsp;foo&nbsp;&nbsp;&nbsp;&nbsp;foo"),
12+
({"A": [None]}, None, "&nbsp;None"),
13+
({"A": ["foo foo foo"]}, None, "&nbsp;foo&nbsp;foo&nbsp;foo"),
14+
]) #test cases
2615

27-
# capture html output
28-
html_output = df._repr_html_()
16+
def test_float_formatting_html_output(self,data,format_option, expected_values):
17+
# set float format, avoid for string checks
18+
if format_option is not None:
19+
pd.set_option("display.float_format", format_option.format)
20+
21+
# crate dataframe
22+
df = pd.DataFrame(data)
23+
24+
# capture html output
25+
html_output = df._repr_html_()
2926

30-
# check
31-
assert expected_values in html_output
27+
# check
28+
assert expected_values in html_output
3229

33-
# reset option
34-
if format_option is not None:
35-
pd.reset_option("display.float_format")
30+
# reset option
31+
if format_option is not None:
32+
pd.reset_option("display.float_format")

0 commit comments

Comments
 (0)