[BUG] mismatch in up-casting Series.__setitem__
between pandas and cudf
#11901
Labels
2 - In Progress
Currently a work in progress
bug
Something isn't working
Python
Affects Python cuDF API.
Describe the bug
Expected behavior
cudf should mimic pandas behaviour here.
[Aside, I hate hate hate this upcasting from ints to floats since it is lossy for round-tripping, but I suppose we must live with it.]
Things work if I specify a list of indices:
The relevant code on a series does this:
https://github.com/rapidsai/cudf/blob/branch-22.12/python/cudf/cudf/core/series.py#L216-L234
Note that if the key is a single integer, we don't upcast the column to the union dtype.
This logic goes back to #2442 which introduced
__setitem__
(@shwina can you remember why?). I note that the__setitem__
implementation onColumn
has the opposite casting rules (ifcol[idx] = value
doesvalue.astype(col.dtype)
), so there must be an explicit choice inSeries.__setitem__
to mimic pandas.Plausibly this is a fix:
The text was updated successfully, but these errors were encountered: