Skip to content

Optional tolerance feature to isin per issue #5587 #5862

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

shazelquist
Copy link

@shazelquist shazelquist commented Oct 14, 2021

  • Closes Tolerance argument for da.isin()? #5587
  • Tests added
  • Passes pre-commit run --all-files
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst doesn't appear to be necessary

This implementation is similar to suggested vectorized solution 1, but acts more according to the issue specifications.

I'm pretty this pull fails checks 4 and 5, but they may not be relevant to expanding functions from the apply_ufunc dispatcher?
I will write an update if this is the case or any other changes are required.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2021

Unit Test Results

         6 files           6 suites   47m 40s ⏱️
16 267 tests 14 537 ✔️ 1 730 💤 0
90 798 runs  82 619 ✔️ 8 179 💤 0

Results for commit b2e32aa.

♻️ This comment has been updated with latest results.

@pep8speaks
Copy link

pep8speaks commented Oct 15, 2021

Hello @shazelquist! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-10-23 00:24:37 UTC


@pytest.mark.parametrize("shape", [(200, 1), (10, 10, 2), (4, 50)])
@pytest.mark.parametrize("tolerance", [1e-2, 1e-4, 1e-6])
def test_isin_tolerance(shape, tolerance):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test with dask arrays as well?

Copy link
Author

Choose a reason for hiding this comment

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

Sure! Does the implementation in commit b79620a cover dask arrays?

Copy link
Contributor

Choose a reason for hiding this comment

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

You have to change the expected value as well. Because if I input a dask array I would expect to get a dask array out as well from a duckarray operation.

There's also a assert_duckarray_equal that you maybe can use instead of numpys version:

def assert_duckarray_equal(x, y, err_msg="", verbose=True):

I'm probably missing something but it is kind of surprising it hasn't already been imported in this test module.

Copy link
Author

Choose a reason for hiding this comment

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

Oh yeah, that makes sense. Thanks for the clarification!

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.

Tolerance argument for da.isin()?
4 participants