Skip to content

Added multi-axis advanced indexing support - #343

Merged
hameerabbasi merged 6 commits into
pydata:masterfrom
MEZTech-LLC:master
May 15, 2020
Merged

hameerabbasi merged 6 commits into
pydata:masterfrom
MEZTech-LLC:master

Conversation

@MEZTech-LLC

Copy link
Copy Markdown
Contributor

Added support for multi-axis advanced indexing. Speed is comparable to single axis advanced indexing.

@hameerabbasi

Copy link
Copy Markdown
Collaborator

Thanks! This is missing some tests, those are pretty much essential.

@MEZTech-LLC

Copy link
Copy Markdown
Contributor Author

It seems like the only failed test is test_slicing_errors(index).
Seems like an issue with the tests. This is likely because an IndexError is no longer being raised if len(adv_idx) is greater than 1 in _coo.indexing.py

What's the protocol for modifying the test cases?

Would you be able to handle this?

@hameerabbasi

Copy link
Copy Markdown
Collaborator

Seems like an issue with the tests. This is likely because an IndexError is no longer being raised if len(adv_idx) is greater than 1 in _coo.indexing.py

That's because the test was "testing" if we didn't have advanced indexing at all. You can get rid of the bad tests.

@hameerabbasi

Copy link
Copy Markdown
Collaborator

What's the protocol for modifying the test cases?

The contributor usually adds tests, and the maintainer/reviewer reviews the code and tests.

@MEZTech-LLC

MEZTech-LLC commented May 14, 2020 •

Copy link
Copy Markdown
Contributor Author

Alright, I'll add a few test cases to test_slicing(index) + remove test_slicing_error and submit a new PR

@hameerabbasi

Copy link
Copy Markdown
Collaborator

Oh, you can just push to your branch and it'll modify this PR. Don't need to close at all.

@hameerabbasi hameerabbasi reopened this May 14, 2020
@MEZTech-LLC

Copy link
Copy Markdown
Contributor Author

Bug found in returned coordinates. Will attempt to fix tomorrow

@hameerabbasi hameerabbasi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you need to add back the tests. It seems the previous tests only had 1D advanced indexing... That's okay, but we need a reasonable error message for not 1D that checks for an error.

Comment thread multi_adv_ix_test.py Resolved
Comment thread multi_adv_ix_test2.py Resolved

@hameerabbasi hameerabbasi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The rest of the failures can be fixed by running pip install black and then black ..

Comment thread sparse/_coo/indexing.py Resolved
@codecov

codecov Bot commented May 15, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #343 into master will decrease coverage by 0.04%.
The diff coverage is 90.00%.

@@            Coverage Diff             @@
##           master     #343      +/-   ##
==========================================
- Coverage   94.11%   94.07%   -0.05%     
==========================================
  Files          19       19              
  Lines        2379     2395      +16     
==========================================
+ Hits         2239     2253      +14     
- Misses        140      142       +2     

@hameerabbasi
hameerabbasi merged commit 38ed16f into pydata:master May 15, 2020
@hameerabbasi

Copy link
Copy Markdown
Collaborator

Thanks, @mikeymezher!

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

Successfully merging this pull request may close these issues.

2 participants