Skip to content

Commit 5e55d1e

Browse files
authored
boolean dtype regression (#46548)
Co-authored-by: JHM Darbyshire (iMac) <[email protected]>
1 parent 8808db8 commit 5e55d1e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/source/whatsnew/v1.4.2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Fixed regressions
2121
- Fixed regression in :meth:`DataFrame.replace` when a replacement value was also a target for replacement (:issue:`46306`)
2222
- Fixed regression in :meth:`DataFrame.replace` when the replacement value was explicitly ``None`` when passed in a dictionary to ``to_replace`` (:issue:`45601`, :issue:`45836`)
2323
- Fixed regression when setting values with :meth:`DataFrame.loc` losing :class:`MultiIndex` names if :class:`DataFrame` was empty before (:issue:`46317`)
24-
-
24+
- Fixed regression when rendering boolean datatype columns with :meth:`.Styler` (:issue:`46384`)
2525

2626
.. ---------------------------------------------------------------------------
2727

pandas/tests/io/formats/style/test_format.py

+8
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,11 @@ def test_1level_multiindex():
434434
assert ctx["body"][0][0]["is_visible"] is True
435435
assert ctx["body"][1][0]["display_value"] == "2"
436436
assert ctx["body"][1][0]["is_visible"] is True
437+
438+
439+
def test_boolean_format():
440+
# gh 46384: booleans do not collapse to integer representation on display
441+
df = DataFrame([[True, False]])
442+
ctx = df.style._translate(True, True)
443+
assert ctx["body"][0][1]["display_value"] is True
444+
assert ctx["body"][0][2]["display_value"] is False

0 commit comments

Comments
 (0)