Open bdice opened 1 week ago
It appears the cudf.pandas bug is that _AtIndexer
(and _iAtIndexer
) indexer are not defined in _wrappers/pandas.py
as proxy objects.
And of course, it appears cudf.DataFrame.loc.__setitem__
that expands is also buggy
More investigation notes:
So cudf.DataFrame.at
is just returns cudf.DataFrame.loc
, so a pandas.DataFrame.at
call will always succeed to return cudf.pandas' intermediate proxy of pandas.DataFrame.loc
.
So if pandas.DataFrame.at.__setitem__
fails in cudf.pandas
, we rewind to pandas.DataFrame.loc.__setitem__
instead of pandas.DataFrame.at.__setitem__
.
I think we need pandas.DataFrame.at
to be an IntermediateProxy
of an IntermediateProxy
as "proper" fix. I'm not sure if there's an straightforward way to do this today.
Alternatively, if we make cudf.DataFrame.at
not map to cudf.DataFrame.loc
(i.e. return a different object with the same implementation), that would be an easier fix...
Alternatively, if we make
cudf.DataFrame.at
not map tocudf.DataFrame.loc
(i.e. return a different object with the same implementation), that would be an easier fix...
That sounds like the right thing to do. cudf's object model should mirror that of pandas. If at
returns loc
in cudf but not pandas, that's a problem in the mirrored object model.
Describe the bug I was helping a user Amith with a question about cudf.pandas and the library pandapower (see RAPIDS GoAI Slack). The pandapower notebook examples trigger a bug in cudf.pandas around the
.at
accessor. @Jacey0 helped debug this with me during PyCon 2024. Thanks Jacey!Steps/Code to reproduce bug
Here is a Colab notebook with a reproducer: https://colab.research.google.com/gist/bdice/f5be320dada30671015d5b53642ec19c/solution-test.ipynb
Here is the minimal code snippet needed to reproduce:
Error output:
Expected behavior Here is the output from plain pandas: