Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: frozensets are shown in parentheses (like tuples) #60690

Open
3 tasks done
wjandrea opened this issue Jan 9, 2025 · 1 comment
Open
3 tasks done

ENH: frozensets are shown in parentheses (like tuples) #60690

wjandrea opened this issue Jan 9, 2025 · 1 comment
Labels
Enhancement Output-Formatting __repr__ of pandas objects, to_string

Comments

@wjandrea
Copy link
Contributor

wjandrea commented Jan 9, 2025

Pandas version checks

  • I have checked that this issue has not already been reported.
    • Query: is:issue in:title frozenset
  • I have confirmed this bug exists on the latest version of pandas.
  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

s = pd.Series([frozenset([1])])
print(s)

Issue Description

0    (1)
dtype: object

Expected Behavior

The same as s.map(repr):

0    frozenset({1})
dtype: object

Or if you insist on an abbreviated option, maybe something like this:

0    f{1}
dtype: object

Installed Versions

INSTALLED VERSIONS
------------------
commit                : 3aba767f3ac4507185d911ed120a49969cdee63d
python                : 3.12.8
python-bits           : 64
OS                    : Linux
OS-release            : 5.4.0-204-generic
Version               : #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024
machine               : x86_64
processor             : x86_64
byteorder             : little
LC_ALL                : None
LANG                  : fr_CA.UTF-8
LOCALE                : fr_CA.UTF-8

pandas                : 3.0.0.dev0+1815.g3aba767f3a
numpy                 : 2.1.0.dev0+git20240403.e59c074
dateutil              : 2.9.0.post0
pip                   : 24.3.1
Cython                : None
sphinx                : None
IPython               : 8.22.2
adbc-driver-postgresql: None
adbc-driver-sqlite    : None
bs4                   : None
blosc                 : None
bottleneck            : None
fastparquet           : None
fsspec                : None
html5lib              : None
hypothesis            : None
gcsfs                 : None
jinja2                : None
lxml.etree            : None
matplotlib            : None
numba                 : None
numexpr               : None
odfpy                 : None
openpyxl              : None
psycopg2              : None
pymysql               : None
pyarrow               : None
pyreadstat            : None
pytest                : None
python-calamine       : None
pytz                  : 2024.1
pyxlsb                : None
s3fs                  : None
scipy                 : None
sqlalchemy            : None
tables                : None
tabulate              : None
xarray                : None
xlrd                  : None
xlsxwriter            : None
zstandard             : None
tzdata                : 2024.1
qtpy                  : None
pyqt5                 : None
@wjandrea wjandrea added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 9, 2025
@rhshadrach
Copy link
Member

Thanks for the report. This behavior goes back to

d859d15

I'm positive on adding a special case for frozenset. Unfortunately it isn't straight forward to just use repr as we need to limit the number of elements.

@rhshadrach rhshadrach added Output-Formatting __repr__ of pandas objects, to_string Enhancement and removed Needs Triage Issue that has not been reviewed by a pandas team member Bug labels Jan 10, 2025
@rhshadrach rhshadrach changed the title BUG: frozensets are shown in parentheses (like tuples) ENH: frozensets are shown in parentheses (like tuples) Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

2 participants