-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
IndexError when indexing numpy array with boolean Series #6168
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
Comments
Same for me with pd
|
this is numpy bug exposed because of the changes in Series in 0.13 (its no longer a ndarray sub-class), see here: http://pandas.pydata.org/pandas-docs/dev/whatsnew.html#whatsnew-0130-refactoring numpy doesn't follow the their own protocol, there is a bug report somewhere but to be honest if you are using pandas then no need to do this at all just wrap it in a Series
|
@dsm054 In essence numpy only allows sub-classes of ndarray, not duck-typed where the object actually works correctly (as Series does). maybe because of perf. I thought their was a bug report, but maybe this is an enhancement request, to treat a duck-typed has-as ndarray similarly to a isa-a |
@jreback: yeah, numpy doesn't play well with others. This is a problem in Sage too, where we wrap integer literals typed in at the console with |
@dsm054 I created an issue, see above...I think that if they relaxed the type checking (and provide a more duck-typing model), then it would work; not sure how much work this is though. I have tried to hack around this to get the type checks to work, but they are in the c-api, so not easy way. did I miss anything? |
@Tarlitz @dsm054 good news! numpy 1.9 will now handle this correctly, you can in fact install numpy master and check out for your self..... |
@jreback Cheers mate, I appreciate your efforts :) |
Previously (version 0.11) it was possible to generate a boolean Series, and use that to index a numpy array. Version 0.13.0 breaks this behaviour and raises "IndexError: unsupported iterator index"
The text was updated successfully, but these errors were encountered: