-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Adding isin function for multidimensional arrays #8423
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 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
17faf5a
Adding isin function for multidimensional arrays
brsr 34a40da
Fix comments on pull request
brsr 2b4a81b
keep in1d mostly the same, changes in isin now
brsr db5e5fd
screwed up the whitespace
brsr f63cf31
docs, convert elements to array in case it isn't already
brsr a9bce34
Merge branch 'master' into master
charris f06ed40
Merge branch 'master' into master
charris 0938763
Merge branch 'master' into master
brsr e10ee1e
removing extra line
brsr 0ec089a
support iterables that aren't array_like
brsr ba10c98
it's hasattr not has_attr
brsr e72b686
check for __array__ instead
brsr 818337d
replace list comprehension
brsr 6ace52e
add comment
brsr 7712179
Responding to seberg's comments
brsr a2c9b6c
Removing special handling for sets
brsr 552a193
Renaming elements to element
brsr fa0b0be
eric-wieser's comments
brsr 0ff6be4
Fixes to tests
brsr 545df63
Docstrings, further expanding test
brsr 41e5b0b
spacing
brsr 521d517
Actual zero-d array
brsr 8805bbb
More docstring changes
brsr 4d3f67c
clean up function listing
brsr 0395f39
Update 1.13.0-notes.rst
brsr 3d809a6
Merge branch 'master' into master
brsr d22cafc
discouraged, not deprecated
brsr 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
Docstrings, further expanding test
- Loading branch information
commit 545df63981a66f38c42c5962d2cf6870ebfe3712
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 |
---|---|---|
|
@@ -97,20 +97,19 @@ def assert_isin_equal(a, b): | |
c = [(9, 8), (7, 6)] | ||
d = (9, 7) | ||
assert_isin_equal(c, d) | ||
#zero-d scalar as: | ||
#1st arg | ||
#zero-d array: | ||
f = np.array([3]) | ||
assert_isin_equal(f, b) | ||
assert_isin_equal(a, f) | ||
assert_isin_equal(f, f) | ||
#scalar: | ||
assert_isin_equal(5, b) | ||
#2nd arg | ||
assert_isin_equal(a, 6) | ||
#both args | ||
assert_isin_equal(5, 6) | ||
#empty array-like as: | ||
#empty array-like: | ||
x = [] | ||
#1st arg | ||
assert_isin_equal(x, b) | ||
#2nd arg | ||
assert_isin_equal(a, x) | ||
#both args | ||
assert_isin_equal(x, x) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs a test for 0d |
||
def test_in1d(self): | ||
|
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
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.
[]
is 1d with shape(0,)
, not 0d with shape()
.I'm thinking testing things like
np.isin(somearr, np.array(1))
, ornp.isin(np.array(1), somearr)