-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: stricter typing in Manager.take #51478
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
@@ -3915,6 +3916,11 @@ def _take( | |||
and is_range_indexer(indices, len(self)) | |||
): | |||
return self.copy(deep=None) | |||
else: | |||
# We can get here with a slice via DataFrame.__geittem__ |
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.
Typo in getitem
Is this a column or row-based slice?
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.
column
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.
mind if i add the typo fix to my next Assorted CLN branch?
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.
id like to add a check for slice in __getitem__
before we get here to return self._slice(indexer)
instead, but that may (probably should) cause us to return a view instead of copy.
Once that is changed, I'd like to deprecate allowing slice in DataFrame.take (which we don't allow in Series.take). It isn't documented, but still.
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.
Yeah fine by me.
Take returns a view for CoW even if it’s not a slice iirc. deprecating sounds good though.
thx @jbrockmendel |
Handle the slice case at at the ndframe level; in future passes I'd like to avoid allowing slices in .take altogether.