-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: enable concat for nullable Int with other dtypes #34095
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
Comments
As a concrete example, this currently gives object dtype:
while it could perfectly preserve the nullable Int64 dtype. (cc @dsaxton in case you are interested) |
@jorisvandenbossche Interesting, how do you envision the case of concating nullable ints and floats? Try casting the float values to nullable int if possible, else use float? I suppose always converting to the more general float type seems more natural in that it would depend entirely on the types and not the values, but then the NAs would be lost (at least until there's a nullable float). |
We want to move not have any value-depending concat/cast behaviour (right now we have such a few cases), so this means that int+float should always result in float. |
@jorisvandenbossche what else do you want to do here for 1.1? Currently, I think the remaining issue is for |
Indeed, with boolean we can already preserve the nullable dtype. For float we have to wait on the Floating EA PR. And Int64+int64 (with numpy dtype) I did in a previous PR. |
Following-up on #33607 which added the
ExtensionDtype._get_common_dtype
method to the EA interface to determine concat/append behaviour, we can now use this to refine the concat behaviour for nullable integer and boolean dtypes.See comment here: #33607 (comment)
For now, the PR only enabled concat of all IntegerDtype objects (any other combination will result in object dtype). But, we can expand this to the combination of IntegerDtype with numpy int dtype, Int with boolean, Int with float, etc
The text was updated successfully, but these errors were encountered: