Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

boolean 1d larry indexing for getting items. #61

Closed
stroxler opened this Issue Jun 25, 2012 · 3 comments

Comments

Projects
None yet
2 participants

At least for 1d larrys, it makes sense to allow users to get a subset using a larry for indexing. I believe this functionality actually exists already for setting items. So if larry is 1d, the following could be legal:

>>> larry[larry < 0].sum()

At the moment, this will crash; instead you have to do

>>> larry[larry.x < 0].sum()

We could be very strict about this and only allow 1d larrys where the indexing larry is a perfect match in terms of labels. If we were ambitious we could flatten higher-d larrys (that's what numpy does), but dealing with the labels could make that too confusing to justify the convenience.

Owner

kwgoodman commented Jun 25, 2012

First step is done in commit 49ff728: refactor the larry.getitem unit tests. Next step would be to add unit tests for bool 1d larry indexing.

@kwgoodman kwgoodman closed this in bbf7c96 Jun 28, 2012

Owner

kwgoodman commented Jun 28, 2012

I did a quick fix to add this feature. Give it a try to make sure it behaves as you expect.

Looks great to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment