-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: include conversion to nullable float in convert_dtypes() #38117
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: include conversion to nullable float in convert_dtypes() #38117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is after the feature freeze, so moving off 1.2
We had a long discussion about this in the original PR (#30929), and I want to remind that it was actually you who asked for the separate options .. (I personally think we should not have added ay of those options in the first place) If we want to change the interface of |
and am happy to revisit but not at the 11hour |
I am happy with leaving out the option, but I think we should still include the actual functionality in 1.2. The float EA array already is included in 1.2, this just enables it in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok this is fine (we should change the api but that's a future issue, do we have one?)
is there a test for convert_floating=True & convert_integer=True and it converts floats to ints?
otherwise lgtm
@@ -6173,7 +6182,7 @@ def convert_dtypes( | |||
>>> dfn = df.convert_dtypes() | |||
>>> dfn | |||
a b c d e f | |||
0 1 x True h 10 NaN | |||
0 1 x True h 10 <NA> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be worth mentioning here that this changed in 1.2
No, but I will open one.
Yes, all possible combo's of all parameters are tested, and we have cases of both integer-like floats as well as actual floats that can't be casted to int |
thanks @jorisvandenbossche |
xref #38110
There is one potentially corner case: what with floats that are all "integer"-like? I think we want to keep returning nullable int for that, at least by default, and that is what I did now in this PR But we might want to add a parameter controlling that behaviour? (but that can also be added later on if there is demand for it)