-
Notifications
You must be signed in to change notification settings - Fork 108
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
[SIT-2372] Add the DataFrame.map
method
#2315
base: main
Are you sure you want to change the base?
[SIT-2372] Add the DataFrame.map
method
#2315
Conversation
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
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.
lgtm
@sfc-gh-aalam could you help review this PR? |
src/snowflake/snowpark/dataframe.py
Outdated
self, | ||
func: Callable, | ||
output_types: list[StructType], | ||
output_column_names: Optional[list[str]] = None, |
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 suggest adding a *
before this parameter to make these optional parameters key-word arguments.
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.
Thanks for your suggestion.
I just removed the extra_packages
parameter and added a **kwargs
parameter to pass arguments to the UTDF registration (as with other similar methods).
@@ -4188,6 +4189,117 @@ def _explain_string(self) -> str: | |||
|
|||
return f"{msg}\n--------------------------------------------" | |||
|
|||
def map( |
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.
A UDTF call may have other parameters like partitioning.
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.
As part of the previous comment, the**kwargs
parameter can be used to pass arguments to the UDTF registration.
Adds the `DataFrame.map` method which applies a Python function to every element of a DataFrame.
Added a `kwargs` parameter to pass arguments to the UDTF registration function. Part of the code review comments.
55fd1bb
to
4fb368f
Compare
Skips executing `test_map` in local testing mode because it requires UDTFs.
Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing |
Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing |
Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing |
Adds the
DataFrame.map
method which applies a Python function to every element of a DataFrame.Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SIT-2372
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Adds the
DataFrame.map
method that applies a Python function to every row of a DataFrame.