Skip to content

feat: Add __contains__ to Index, Series, DataFrame #1899

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 7 commits into from
Jul 11, 2025

Conversation

TrevorBergeron
Copy link
Contributor

@TrevorBergeron TrevorBergeron commented Jul 10, 2025

BEGIN_COMMIT_OVERRIDE
feat: Add __contains__ to Index, Series, DataFrame (#1899)
END_COMMIT_OVERRIDE

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 Jul 10, 2025
@TrevorBergeron TrevorBergeron marked this pull request as ready for review July 10, 2025 22:36
@TrevorBergeron TrevorBergeron requested review from a team as code owners July 10, 2025 22:36
@TrevorBergeron TrevorBergeron requested a review from tswast July 10, 2025 22:36
@TrevorBergeron TrevorBergeron requested review from GarrettWu and removed request for tswast July 10, 2025 22:36
sycai
sycai previously approved these changes Jul 10, 2025
Comment on lines 1410 to 1412
bf_result = scalars_df_index.set_index(col_name).index.__contains__(key)
pd_result = scalars_pandas_df_index.set_index(col_name).index.__contains__(key)
assert bf_result == pd_result
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Let's use key in abc.index for testing instead.

Also empty lines before assertions ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

sycai
sycai previously approved these changes Jul 11, 2025
Comment on lines 4464 to 4466
bf_result = scalars_df_index.__contains__(key)
pd_result = scalars_pandas_df_index.__contains__(key)
assert bf_result == pd_result
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we update these too?

Comment on lines 437 to 439
bf_result = scalars_df_index["int64_col"].__contains__(key)
pd_result = scalars_pandas_df_index["int64_col"].__contains__(key)
assert bf_result == pd_result
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we update these lines too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh, missed that one, fixed

@TrevorBergeron TrevorBergeron merged commit 07222bf into main Jul 11, 2025
24 of 25 checks passed
@TrevorBergeron TrevorBergeron deleted the series_contains branch July 11, 2025 19:48
@shobsi shobsi changed the title feat: Add __contains__ to Index, Series, DataFrame feat: Add __contains__ to Index, Series, DataFrame Jul 15, 2025
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