Skip to content

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

Closed
wants to merge 3 commits into from
Closed

BUG: fix indexing.py to make a copy of the indices (#20852) #20855

wants to merge 3 commits into from

Conversation

subhrm
Copy link

@subhrm subhrm commented Apr 28, 2018

WIP. Reviewing the test cases and would add a test case to validate this fix.

@pep8speaks
Copy link

pep8speaks commented Apr 28, 2018

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
Copy link

codecov bot commented May 2, 2018

Codecov Report

Merging #20855 into master will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.21% <ø> (+0.04%) ⬆️
#single 41.85% <ø> (-0.04%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexing.py 93.56% <ø> (+0.42%) ⬆️
pandas/core/frame.py 97.13% <0%> (-0.1%) ⬇️
pandas/core/indexes/timedeltas.py 91.15% <0%> (-0.07%) ⬇️
pandas/core/indexes/datetimes.py 95.73% <0%> (-0.04%) ⬇️
pandas/core/generic.py 95.94% <0%> (ø) ⬆️
pandas/core/reshape/pivot.py 96.97% <0%> (ø) ⬆️
pandas/core/panel.py 97.29% <0%> (ø) ⬆️
pandas/io/formats/latex.py 100% <0%> (ø) ⬆️
pandas/core/resample.py 96.07% <0%> (ø) ⬆️
pandas/core/reshape/concat.py 97.59% <0%> (ø) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 563a6ad...6b0a872. Read the comment docs.

Copy link
Contributor

@jreback jreback left a 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)

@@ -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:
Copy link
Contributor

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()

Copy link
Author

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.

Copy link
Author

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 .

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves labels May 4, 2018
@jorisvandenbossche jorisvandenbossche changed the title [WIP] #20852 - Fix indexing.py to make a copy of the indices BUG: fix indexing.py to make a copy of the indices (#20852) Jun 6, 2018
@jorisvandenbossche
Copy link
Member

@subhrm Can you update for @jreback 's questions:

  • whatsnew note (a small note in v0.23.1.txt in the bug fixes section
  • add a test (in tests/indexing/test_indexing.py). You can use the example in the issue, and then assert that the indexer array has not changed

@subhrm
Copy link
Author

subhrm commented Jun 6, 2018

@jorisvandenbossche sorry I could not devote any time for this.
I would do the suggested changes and update by this weekend (10th June).
Thanks for reminding me.

@subhrm
Copy link
Author

subhrm commented Jul 17, 2018

Implemented via PR #21867 . Closing this one.

@subhrm subhrm closed this Jul 17, 2018
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.

np array indexer modified in iloc
4 participants