-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: fix indexing.py to make a copy of the indices (#20852) #20855
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
Conversation
Hello @subhrm! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on May 07, 2018 at 16:55 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #20855 +/- ##
==========================================
+ Coverage 91.77% 91.81% +0.03%
==========================================
Files 153 153
Lines 49313 49479 +166
==========================================
+ Hits 45259 45430 +171
+ Misses 4054 4049 -5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add
- whatsnew note
- tests (in tests/indexing/test_indexing.py)
pandas/core/indexing.py
Outdated
@@ -2413,6 +2413,9 @@ def maybe_convert_indices(indices, n): | |||
# If list is empty, np.array will return float and cause indexing | |||
# errors. | |||
return np.empty(0, dtype=np.int_) | |||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move the copy to inside mask.any() check as its only needed there. use indices.copy()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review comments. I have made the changes as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would add new testcases for this change .
@jorisvandenbossche sorry I could not devote any time for this. |
Implemented via PR #21867 . Closing this one. |
git diff upstream/master -u -- "*.py" | flake8 --diff
WIP. Reviewing the test cases and would add a test case to validate this fix.