-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: pandas.core.ops.dispatch_to_extension_op fails with UnboundLocalError #22414
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
@xhochy : Thanks for reporting this! Two things:
|
Added the exception including the traceback to the initial post. My expected output would be that the |
@xhochy : How to best to incorporate support for non-ndarray is TBD, but the |
Yes, this is a thing I need to write an example ExtensionArray for in the Pandas tests. I've been reporting these bugs but it is always hard to make reproducible tests. I hope to find enough time in a single block soon to write such an example ExtensionArray. Then it will be simpler to fix them with a reproducing test. |
IIRC, I have a fix for this in my big Sparse PR. I can split it off. |
Basically we need a test ExtensionArray that does not use an ndarray as its backing values? |
Pandas looks quite often in its internal code into |
Yes, but what you say is the distinction between ndarray and EA for
And for sure it does! |
@xhochy BTW, in the meantime, there is a non-ndarray backed example ExtensionArray (based on a pyarrow array) that is used for testing (since this was a problem for you to write a test). |
Code Sample, a copy-pastable example if possible
This bug requires an ExtensionArray that is not backed with a numpy array to occur.
Problem description
Looking at the code the value of
new_right
is only set when the the values of the ExtensionArray are anp.ndarray
. With fletcher, this is not the case.pandas/pandas/core/ops.py
Lines 1142 to 1156 in 8bb2cc1
Error message
The text was updated successfully, but these errors were encountered: