Skip to content

Commit 5e5da07

Browse files
authored
BUG: Fix frozenset display in pprint (#60867)
* Fix frozenset display in pprint It needs to have braces like a set. * Fix frozenset pprint test
1 parent 11e3dc2 commit 5e5da07

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pandas/io/formats/printing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def _pprint_seq(
112112
if isinstance(seq, set):
113113
fmt = "{{{body}}}"
114114
elif isinstance(seq, frozenset):
115-
fmt = "frozenset({body})"
115+
fmt = "frozenset({{{body}}})"
116116
else:
117117
fmt = "[{body}]" if hasattr(seq, "__setitem__") else "({body})"
118118

pandas/tests/io/formats/test_printing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_repr_mapping(self):
8383
assert printing.pprint_thing(MyMapping()) == "{'a': 4, 'b': 4}"
8484

8585
def test_repr_frozenset(self):
86-
assert printing.pprint_thing(frozenset([1, 2])) == "frozenset(1, 2)"
86+
assert printing.pprint_thing(frozenset([1, 2])) == "frozenset({1, 2})"
8787

8888

8989
class TestFormatBase:

0 commit comments

Comments
 (0)