Skip to content

BUG: Nullable floats can look like ints in repr #36775

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

Closed
dsaxton opened this issue Oct 1, 2020 · 3 comments · Fixed by #36800
Closed

BUG: Nullable floats can look like ints in repr #36775

dsaxton opened this issue Oct 1, 2020 · 3 comments · Fixed by #36800
Labels
Bug NA - MaskedArrays Related to pd.NA and nullable extension arrays Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@dsaxton
Copy link
Member

dsaxton commented Oct 1, 2020

Nullable floats when output to the screen can look like ints, but in my opinion should look the same as regular non-NaN floats so as not to cause confusion.

import pandas as pd

s = pd.Series([0.0, 1.0, None], dtype="Float64")
print(s)
# 0       0
# 1       1
# 2    <NA>
# dtype: Float64
print(s.astype(float))
# 0    0.0
# 1    1.0
# 2    NaN
# dtype: float64
pd.__version__
# '1.2.0.dev0+560.g86f543143'

cc @jorisvandenbossche

@dsaxton dsaxton added Bug Output-Formatting __repr__ of pandas objects, to_string NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Oct 1, 2020
@dsaxton dsaxton added this to the 1.1.4 milestone Oct 1, 2020
@simonjayhawkins
Copy link
Member

@dsaxton why is this milestoned 1.1.4. Does #36800 fix some existing formatting issues. test_nullable_float_to_string can't be backported (#34307 is an enhancement for 1.2)

@jorisvandenbossche jorisvandenbossche modified the milestones: 1.1.4, 1.2 Oct 2, 2020
@jorisvandenbossche
Copy link
Member

Yeah, since nullable floats are only in master, this issue is also for master.

@jorisvandenbossche
Copy link
Member

But fully agree on the actual bug report! We should indeed ensure that they look as floats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug NA - MaskedArrays Related to pd.NA and nullable extension arrays Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants