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: value counts with mixed NaNs is oddly rendering #45222

Closed
jreback opened this issue Jan 6, 2022 · 3 comments
Closed

BUG: value counts with mixed NaNs is oddly rendering #45222

jreback opened this issue Jan 6, 2022 · 3 comments
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Jan 6, 2022

in the 1.40rc1 release notes: https://pandas.pydata.org/pandas-docs/version/1.4/whatsnew/v1.4.0.html#null-values-are-no-longer-coerced-to-nan-value-in-value-counts-and-mode

We are seeing distinct NaN , but I think we should be seeing NaN and NaT

Looks like we patched here: #42743

@jreback jreback added the Bug label Jan 6, 2022
@jreback jreback added this to the 1.4 milestone Jan 6, 2022
@jreback
Copy link
Contributor Author

jreback commented Jan 6, 2022

cc @realead if you can

@realead
Copy link
Contributor

realead commented Jan 7, 2022

@jreback Sorry I didn't pay the needed attention to the output and overlooked that when a series is printed all null-values are printed as NaN, i.e.:

import pandas as pd
import numpy as np
s=pd.Series([1, 2, 3, 4], [True, None, np.nan, pd.NaT])

and now

print(s.keys())
print(s[np.nan])

work as expected:

Index([True, None, nan, NaT], dtype='object')
3

but

print(s)

yields:

True    1
NaN     2
NaN     3
NaN     5

i.e. all NaNs.

For the documentation it is probably better to create another example.

But is this the behavior of series one would like to have/expect with print?

@realead
Copy link
Contributor

realead commented Jan 20, 2022

I think this issue is closed via #45283

@jreback jreback closed this as completed Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants