Skip to content
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: Add DataFrame.corrwith method #1315

Merged
merged 3 commits into from
Jan 24, 2025
Merged

feat: Add DataFrame.corrwith method #1315

merged 3 commits into from
Jan 24, 2025

Conversation

TrevorBergeron
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jan 23, 2025
@TrevorBergeron TrevorBergeron marked this pull request as ready for review January 23, 2025 18:54
@TrevorBergeron TrevorBergeron requested review from a team as code owners January 23, 2025 18:54
@TrevorBergeron TrevorBergeron requested a review from tswast January 23, 2025 18:54
@TrevorBergeron TrevorBergeron requested review from sycai and removed request for tswast January 23, 2025 22:33
numeric_only: bool = False,
):
other_frame = other if isinstance(other, DataFrame) else other.to_frame()
if not numeric_only:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's re-write this if-else block as

if numeric_only:
...
else
...

See go/tott/685

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

pd.testing.assert_series_equal(
bf_result, pd_result, check_dtype=False, check_index_type=False
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should add two more cases:

numeric_only = True, two dfs contain only numeric columns => computation proceeds successfully
numeric_only = True, one of the dfs has a non-numeric column => an error is raised.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@TrevorBergeron TrevorBergeron requested a review from sycai January 24, 2025 00:35
@TrevorBergeron TrevorBergeron merged commit b503355 into main Jan 24, 2025
22 checks passed
@TrevorBergeron TrevorBergeron deleted the corr_with branch January 24, 2025 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants