-
Notifications
You must be signed in to change notification settings - Fork 104
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
feat: consistently return Python scalars from Series reductions for PyArrow #1471
Conversation
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.
Diff looks good! I have a couple of comments π
narwhals/_arrow/series.py
Outdated
def maybe_extract_py_scalar(value: Any, return_py_scalar: bool) -> Any: # noqa: FBT001 | ||
if return_py_scalar: | ||
return to_py_scalar(value) | ||
return value |
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.
Should we target this to arrow specifically instead of using the more generic to_py_scalar
?
extra_kwargs = ( | ||
{"_return_py_scalar": False} | ||
if returns_scalar and expr._implementation is Implementation.PYARROW | ||
else {} | ||
) |
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.
Neat! β¨
Co-authored-by: Francesco Bruzzesi <[email protected]>
thanks @FBruzzesi ! any other comments? |
I am from mobile but it seems good! Thanks for addressing both points :) |
What type of PR is this? (check all applicable)
Related issues
Checklist
If you have comments or can explain your changes, please do so below