-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Support multiplication of pd.ArrowDtype(pa.string()) and integral value where integral value is a series #56538
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
Support multiplication of pd.ArrowDtype(pa.string()) and integral value where integral value is a series #56538
Conversation
This reverts commit 15f1990.
pandas/core/arrays/arrow/array.py
Outdated
pa_integral = pc.if_else(pc.less(integral, 0), 0, integral) | ||
return pc.binary_repeat(binary, pa_integral) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you inline these where needed. I don't think a whole new function is needed for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mroeschke, can do, but there's 2 callers of it, so if we remove the function, the logic for calculating the repeat count to pass to binary_repeat would need to be repeated in both callers. Additionally, I believe the helper function simplifies the code because there's 2 scenarios:
- binary is lhs and int is rhs
- binary is rhs and int is lhs
When we call binary_repeat, we need to always ensure the binary is the left arg and the integral is the right arg, imo the helper function simplifies the code and makes it a bit more readable. Let me know if you would still prefer logic of _evaluate_binary_repeat to be inlined, or if I misunderstood your suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still prefer to inline this for now. We don't really use staticmethods in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, inlined.
Thanks @rohanjain101 |
…ue where integral value is a series (pandas-dev#56538) * allow repeat count to be a series * fix validation * gh reference * fix conditional logic * Revert "fix conditional logic" This reverts commit 15f1990. * remove condition * inline --------- Co-authored-by: Rohan Jain <[email protected]>
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.