Skip to content

BUG: .isin(...) now coerces sets to lists #13014

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

Closed
wants to merge 3 commits into from
Closed

BUG: .isin(...) now coerces sets to lists #13014

wants to merge 3 commits into from

Conversation

mao-liu
Copy link

@mao-liu mao-liu commented Apr 28, 2016

  • closes Series.isin(values) raises ValueError if values is a set #12988
  • tests added, passed
  • passes git diff upstream/master | flake8 --diff
  • comp.isin(values) now coerces values from a set into a list. This was failing when comp is a datetime dtype and values is a set, where .isin will try to run to_datetime(values) on the unordered set and fail.

@jreback
Copy link
Contributor

jreback commented Apr 28, 2016

tests!

@mao-liu
Copy link
Author

mao-liu commented Apr 28, 2016

I swear git add is playing games with me... sorry about that.

@mao-liu
Copy link
Author

mao-liu commented Apr 28, 2016

How to kill an underway Travis job?

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves labels Apr 28, 2016
@@ -113,6 +113,8 @@ def isin(comps, values):
raise TypeError("only list-like objects are allowed to be passed"
" to isin(), you passed a "
"[{0}]".format(type(values).__name__))
if com.is_set_like(values):
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of doing this, I think you can:

if not isinstance(values, np.ndarray):
    values = list(values)

Then don't even need the next check

@codecov-io
Copy link

Current coverage is 83.91%

Merging #13014 into master will increase coverage by +<.01%

@@             master     #13014   diff @@
==========================================
  Files           136        136          
  Lines         49908      49920    +12   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          41876      41888    +12   
  Misses         8032       8032          
  Partials          0          0          

Powered by Codecov. Last updated by 0294c48

@jreback jreback added this to the 0.18.1 milestone Apr 29, 2016
@jreback
Copy link
Contributor

jreback commented Apr 29, 2016

@ch41rmn gr8. can you add a whatsnew note in bug fixes. ping when pushed.

@jreback
Copy link
Contributor

jreback commented Apr 30, 2016

looks good. can you add a whatsnew note. ping when pushed.

@jreback jreback closed this in 05e734a May 1, 2016
@jreback
Copy link
Contributor

jreback commented May 1, 2016

thanks @ch41rmn I merged this. hoping to get the release out shortly.

@mao-liu
Copy link
Author

mao-liu commented May 1, 2016

Thanks for merging @jreback. Apologies I didn't get to adding the whatsnew note in time, have been away for the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series.isin(values) raises ValueError if values is a set
3 participants