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: pd.NA values sometimes printed as NaN #56394

Closed
2 of 3 tasks
RomeshA opened this issue Dec 8, 2023 · 1 comment
Closed
2 of 3 tasks

BUG: pd.NA values sometimes printed as NaN #56394

RomeshA opened this issue Dec 8, 2023 · 1 comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@RomeshA
Copy link

RomeshA commented Dec 8, 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.

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

Reproducible Example

import pandas as pd
df = pd.DataFrame([pd.NA]*60)
df2 = pd.DataFrame([pd.NA]*61)
print(df)
print(df2)

Issue Description

When the dataframe has fewer rows than the setting display.max_rows, it is printed with the values showing as <NA>. However, if the dataframe has more rows, those same values are printed as NaN.

Expected Behavior

print(df2) should show

      0
0   <NA>
1   <NA>
2   <NA>
3   <NA>
4   <NA>
..  ...
56  <NA>
57  <NA>
58  <NA>
59  <NA>
60  <NA>

instead of

      0
0   NaN
1   NaN
2   NaN
3   NaN
4   NaN
..  ...
56  NaN
57  NaN
58  NaN
59  NaN
60  NaN

Installed Versions

INSTALLED VERSIONS ------------------ commit : 2a953cf python : 3.11.5.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22621 machine : AMD64 processor : AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD byteorder : little LC_ALL : None LANG : None LOCALE : English_Australia.1252

pandas : 2.1.3
numpy : 1.25.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 68.0.0
pip : 23.2.1
Cython : None
pytest : 7.4.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.1.8
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader : None
bs4 : None
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.8.0
numba : 0.58.0
numexpr : None
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.3
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : 0.21.0
tzdata : 2023.3
qtpy : None
pyqt5 : None

@RomeshA RomeshA added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 8, 2023
@mroeschke
Copy link
Member

Thanks for the report. Closing as a duplicate of #55630

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants