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

Upgrade Pandas dependency to 2.1 #31185

Merged
merged 22 commits into from
May 7, 2024
Merged

Upgrade Pandas dependency to 2.1 #31185

merged 22 commits into from
May 7, 2024

Conversation

tvalentyn
Copy link
Contributor

@tvalentyn tvalentyn commented May 4, 2024

This PR increases the upper bound to allow Pandas 2.1 and makes necessary changes to for Beam dataframe doctests pass.

Expanding the list of ELEMENTWISE_STRING_METHODS enables support of additional dataframe operations in Beam by running them per-element: center, decode, encode, find, index, lfind, ljust, normalize, rfind, rindex, rjust, translate.

Most of the changes exclude newly added doctests tests to Pandas 2.1, which exercise Dataframe operations that are not
supported in Beam, such as order-sensitive operations operations that are not applicable to a distributed, unordered deferred dataframe.

Excluded tests don't appear to be regressions in Pandas 2.1, they were also not supported in Pandas 1.x.

The PR also adds a capability to skip an example from all tests that include it, so that we don't need to exclude the same (unsupported) example multiple times in several tests.

Remaining issue: include a compat tests suite for Pandas 2.1. This is deferred, since current compat test suite uses Python 3.8, for which Pandas 2.1 is not available. In short term, Pandas 2.1 will be on tests against master. We should add a compat test suite for Pandas 2.1 before switching to Pandas 2.2.

fixes: #31198


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@github-actions github-actions bot added the python label May 4, 2024
Copy link
Contributor

github-actions bot commented May 6, 2024

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @riteshghorse for label python.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Copy link
Contributor

@jrmccluskey jrmccluskey left a comment

Choose a reason for hiding this comment

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

LGTM overall, just one general question

@@ -103,6 +109,7 @@ def test_ndframe_tests(self):
'pandas.core.generic.NDFrame.get': ['*'],
},
not_implemented_ok={
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the distinction here that there is a list of operations that we 100% won't implement, and then there are the operations that are just not-yet-implemented but could be?

Copy link
Contributor Author

@tvalentyn tvalentyn May 7, 2024

Choose a reason for hiding this comment

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

yes, that was the original intent. Order-sensitive ops are an example of 'Won't implement', although there is a proposal https://s.apache.org/order-sensitive-dataframe-operations to possibly support them later. The 'Not implemented' ops raise an exception that says, we didn't get around to support it but let us know if you care. See: https://github.com/apache/beam/blob/master/sdks/python/apache_beam/dataframe/frame_base.py#L426-L442

@tvalentyn tvalentyn merged commit 2ca9af8 into apache:master May 7, 2024
79 checks passed
@tvalentyn tvalentyn deleted the pandas21 branch May 7, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Support Pandas 2.1
2 participants