-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Default ExtensionScalarOpsMixin for divmod is incorrect #22930
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
So in pandas/pandas/core/arrays/base.py Lines 777 to 782 in 5ce06b5
@Dr-Irv unreatalted to this issue, we allocate an pandas/pandas/core/arrays/base.py Line 768 in 5ce06b5
itertools.cycle(param) ?
|
Are there any other operators that return a tuple? |
@TomAugspurger Been on vacation, so just seeing this. In the first one, the idea is that we are allowing the result to be a different EA type, which may not be the EA type of the caller. With respect to using |
Also, with respect to the |
Thanks. divmod between two decimals seems to work fine, so we'll re-enable that test with the implementation.
I'm not sure I follow. The expected result of a divmod(array, Any) should be a tuple of arrays In [15]: divmod(np.array([1, 2, 3]), 2)
Out[15]: (array([0, 1, 1]), array([1, 0, 1])) right now we're returning an array (list) of tuples. |
In terms of
And then there is this example:
I think the result of that should be So it is not clear what the expected result should be when the input values are "infinite" decimal numbers. But maybe the test will work now if enabled. When I wrote:
I meant the following. Suppose the EA holds elements of scalar type A. Suppose that the result of the binop for the two scalars of type A is of scalar type B. Then the someone might have a different EA type holding scalars of type B. With the current try/except logic, this case is then covered. |
You think that's a bug in Python? Regardless, the array version should be matching what the scalar version does.
I don't see that. On master, we return a list if the |
I'm not sure if it is a bug in Python, but it makes writing a test for I agree that the array version should do what the scalar version does.
Yes, and that was intentional. I was responding to your comment here:
So I think we're all good in terms of understanding this. |
Code Sample, a copy-pastable example if possible
Expected Output
Any others?
The text was updated successfully, but these errors were encountered: