10000 BUG: .iloc[:] and .loc[:] return a copy of the original object #13873 by margaret · Pull Request #16443 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: .iloc[:] and .loc[:] return a copy of the original object #13873 #16443

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

Merged
merged 13 commits into from
Jun 14, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
_getitem_lowerdim won't return copy of object if called with [:]
  • Loading branch information
margaret committed Jun 14, 2017
commit cd4980ea1a525f3853f4a0d1967ab46680a1be2c
4 changes: 4 additions & 0 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,10 @@ def _getitem_lowerdim(self, tup):
if len(new_key) == 1:
new_key, = new_key

# Slices should return views, but calling iloc/loc with a null
# slice returns a new object.
if is_null_slice(new_key):
return section
# This is an elided recursive call to iloc/loc/etc'
return getattr(section, self.name)[new_key]

Expand Down
0