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

BUG: Large numbers are corrupted in display with hiding index df.style.hide(axis="index") in v1.5.3 #56386

Closed
1 of 3 tasks
orionlee opened this issue Dec 7, 2023 · 5 comments
Labels
Closing Candidate May be closeable, needs more eyeballs Styler conditional formatting using DataFrame.style

Comments

@orionlee
Copy link

orionlee commented Dec 7, 2023

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas. The bug is not in the latest version v2.1.3, but major version upgrade from v1 to v2 is not always possible.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
from IPython.display import display

df = pd.DataFrame(
    data=dict(
        Source=[5676220978733875968, 9876543210987654321, 98765432109876543, 9876543210987654],
        Notes=["Corrupted", "Corrupted", "Corrupted", "okay"],
    )
)
print("The DataFrame: ")
display(df)
print("with style.hide(axis='index'): ")
display(df.style.hide(axis="index"))  # large numbers are corrupted

Issue Description

When displaying numbers while hiding index by df.style.hide(axis="index"), very large numbers could be corrupted in version v1.5.3 .

  • It is no longer an issue in the latest v2.1.3, but major version upgrade is not always possible.
  • The bug is also in v2.0.3 as well.

The output of the example in v1.5.3:
image

Expected Behavior

The numbers shown with df.style.hide(axis="index") should be the actual value.

Installed Versions

The problem is reproduced in a minimal environment with pandas 1.5.3:

INSTALLED VERSIONS

commit : 2e218d1
python : 3.10.13.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : English_United States.1252

pandas : 1.5.3
numpy : 1.26.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 68.2.2
pip : 23.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.18.1
pandas_datareader: None
bs4 : 4.12.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None

@orionlee orionlee added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 7, 2023
@phofl
Copy link
Member

phofl commented Dec 7, 2023

Hi, please check this on 2.1.x

@phofl phofl added the Needs Info Clarification about behavior needed to assess issue label Dec 7, 2023
@orionlee
Copy link
Author

orionlee commented Dec 8, 2023

I did check on 2.1.x , but apparently not prominent enough in the initial comment.

  • the bug is not in 2.1.3,
  • the bug is present in 2.0.3 and 1.5.3

@attack68
Copy link
Contributor

attack68 commented Dec 9, 2023

You can read more about the bug fix here:
#53017

Bugs get fixed, enhancements added and the software versions progress. Software versions do not get retroactively changed, that is the basis of version controlled software.

If this is an issue in your local environment and you cannot upgrade to the later versions of pandas then you must monkey patch the software yourself. The above link should help you indentify the necessary change. It was a simple fix.

@attack68 attack68 added Closing Candidate May be closeable, needs more eyeballs Styler conditional formatting using DataFrame.style and removed Bug Needs Info Clarification about behavior needed to assess issue Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 9, 2023
@phofl
Copy link
Member

phofl commented Dec 9, 2023

Yep agreed, closing this one, we won’t backport fixes to these versions

@phofl phofl closed this as completed Dec 9, 2023
@orionlee
Copy link
Author

orionlee commented Dec 9, 2023

Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closing Candidate May be closeable, needs more eyeballs Styler conditional formatting using DataFrame.style
Projects
None yet
Development

No branches or pull requests

3 participants