-
Notifications
You must be signed in to change notification settings - Fork 52
feat: Support axis=1
in df.apply
for scalar outputs
#629
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
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
4d3200c
feat: Support `axis=1` in `df.apply` for scalar outputs
shobsi ceb7dbc
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 22b7f32
avoid mixing other changes in the input_types param
shobsi 5049170
use guid instead of hard coded column name
shobsi 4f28f56
check_exact=False to avoid failing system_prerelease
shobsi fb92f34
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 2e2f32c
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 99e3e7b
handle index in remote function, add large system tests
shobsi 85efbb7
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 7153db8
make the test case more robust
shobsi 13c2e62
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi c3dddd8
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 5fb8148
handle non-string column names, add unsupported dtype tests
shobsi edbac1b
fix import
shobsi 74aeaea
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi d3c07e9
use `_cached` in df.apply to catch any rf execution errors early
shobsi ed03d28
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 7122b8a
add test for row aggregates
shobsi 8957e10
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 9f9b61e
add row dtype information, also test
shobsi 6fdd282
preserve the order of input in the output
shobsi 37906ee
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 2d137ca
absorb to_numpy() disparity in prerelease tests
shobsi 3e45f78
add tests for column multiindex and non remote function
shobsi e31a09d
add preview note for row processing
shobsi b828860
add warning for input_types="row" and axis=1
shobsi eb383f3
introduce early check on the supported dtypes
shobsi d520337
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 7a3aa5f
asjust test after early dtype handling
shobsi 4d39204
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 7383faf
address review comments
shobsi a8f036a
Merge remote-tracking branch 'refs/remotes/github/main'
shobsi 84d719c
user NameError for column name parsing issue, address test coverage f…
shobsi 4e96b96
address nan return handling in the gcf code
shobsi 4ce3cc9
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 612055d
handle (nan, inf, -inf)
shobsi 1c58ded
replace "row" by bpd.Series for input types
shobsi bede078
make the bq parity assert more readable
shobsi 56a8236
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 3409bc3
fix the series name before assert
shobsi ea7e28e
fix docstring for args
shobsi 14602f8
move more low level string logic in sql module
shobsi 7f5f2a3
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi 3bf5bee
raise explicit error when a column name cannot be supported
shobsi 0149d59
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi b5f3232
keep literal_eval check on the serialization side to match
shobsi bad6df6
Merge remote-tracking branch 'refs/remotes/github/main' into shobs-rf…
shobsi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
""" | ||
Utility functions for SQL construction. | ||
""" | ||
|
||
from typing import Iterable | ||
|
||
|
||
def quote(value: str): | ||
"""Return quoted input string.""" | ||
|
||
# Let's use repr which also escapes any special characters | ||
# | ||
# >>> for val in [ | ||
# ... "123", | ||
# ... "str with no special chars", | ||
# ... "str with special chars.,'\"/\\" | ||
# ... ]: | ||
# ... print(f"{val} -> {repr(val)}") | ||
# ... | ||
# 123 -> '123' | ||
# str with no special chars -> 'str with no special chars' | ||
# str with special chars.,'"/\ -> 'str with special chars.,\'"/\\' | ||
|
||
return repr(value) | ||
|
||
|
||
def column_reference(column_name: str): | ||
"""Return a string representing column reference in a SQL.""" | ||
|
||
return f"`{column_name}`" | ||
|
||
|
||
def cast_as_string(column_name: str): | ||
"""Return a string representing string casting of a column.""" | ||
|
||
return f"CAST({column_reference(column_name)} AS STRING)" | ||
|
||
|
||
def csv(values: Iterable[str], quoted=False): | ||
"""Return a string of comma separated values.""" | ||
|
||
if quoted: | ||
values = [quote(val) for val in values] | ||
|
||
return ", ".join(values) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ideally we'd document these limitations, too, right?
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.
Adding in #800