-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Closed
Labels
API DesignBlockerBlocking issue or pull request for an upcoming releaseBlocking issue or pull request for an upcoming releaseIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves
Milestone
Description
Currently, on the main branch with the PDEP-6 (no-casting in setitem) warnings, we get:
>>> ser[0] = np.nan
FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas.
Value 'nan' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
Given that this is a bit a special cast (with numpy integers not supporting missing values, so we make this upcast in other places like reindexing as well), and in a possible future with nullable integers by default, the above would again be allowed (and then preserve the dtype), we could decide to special case specifically setting NaN into an integer Series for now, and still allow the upcast in this specific case.
@MarcoGorelli opening this issue to keep track of what we discussed. You already started on a fix (#54527?), and I also started working on a short-circuiting helper function to determine if we have an array of only-NaNs-or-integers.
Metadata
Metadata
Assignees
Labels
API DesignBlockerBlocking issue or pull request for an upcoming releaseBlocking issue or pull request for an upcoming releaseIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves