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

in1d needs an asarray call? #2755

Closed
jseabold opened this issue Nov 21, 2012 · 2 comments
Closed

in1d needs an asarray call? #2755

jseabold opened this issue Nov 21, 2012 · 2 comments

Comments

@jseabold
Copy link
Contributor

Consider this

[~/]
[1]: test = np.array([0,1,2,5,0])

[~/]
[2]: states = [0, 2]

[~/]
[3]: np.in1d(test, states)
[3]: array([ True, False,  True, False,  True], dtype=bool)

[~/]
[4]: np.in1d(test, test)
[4]: array([ True,  True,  True,  True,  True], dtype=bool)

[~/]
[5]: np.in1d(states, states)
[5]: array([False, False], dtype=bool)

[~/]
[6]: np.in1d(np.array(states), states)
[6]: array([ True,  True], dtype=bool)
@seberg
Copy link
Member

seberg commented Nov 21, 2012

This is a regression introduced in 6441c2a due to the new special case lacking the asarray call. Maybe it should better be fixed for 1.7? Also a .ravel() should probably be added since at least if assume_unique was not given, this was done in the unique call.

seberg added a commit to seberg/numpy that referenced this issue Dec 8, 2012
There was a regression introduced by the speed improvement in
commit 6441c2a. This fixes it, and generally ravels the arrays for
np.in1d. However it can be argued that at least the first array should
not be ravelled in the future.

Fixes "Issue numpygh-2755"
certik pushed a commit to certik/numpy that referenced this issue Dec 26, 2012
There was a regression introduced by the speed improvement in
commit 6441c2a. This fixes it, and generally ravels the arrays for
np.in1d. However it can be argued that at least the first array should
not be ravelled in the future.

Fixes "Issue numpygh-2755"
@seberg
Copy link
Member

seberg commented Jan 3, 2013

Fixed in 1.7 and master.

@seberg seberg closed this as completed Jan 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants