-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: Deprecate set and dict as indexers #45052
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
pandas/core/frame.py
Outdated
@@ -3456,7 +3456,32 @@ def _iter_column_arrays(self) -> Iterator[ArrayLike]: | |||
for i in range(len(self.columns)): | |||
yield self._get_column_array(i) | |||
|
|||
def _check_deprecated_indexers(self, key): |
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 this be a function in indexing.py
or similar?
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.
Yep done, hadn't had much time on friday and wanted to check at least whether I got every occurrence in the test suite
pandas/core/indexing.py
Outdated
@@ -942,7 +950,32 @@ def _getitem_nested_tuple(self, tup: tuple): | |||
def _convert_to_indexer(self, key, axis: int): | |||
raise AbstractMethodError(self) | |||
|
|||
def _check_deprecated_indexers(self, key): |
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.
same make this a function (and just call it here)
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.
iloc does not work for unhashable objects for getitem and setitem
Do we have tests for this behavior? Otherwise LGTM
Not 100% sure, but wanted to add explicit checks as followups to raise a controlled error. Something we can reuse for the deprecated cases. |
sgtm |
thanks @phofl |
closes DOC: .loc doesn't document that it can take sets or dicts as arguments #42825
tests added / passed
Ensure all linting tests pass, see here for how to run them
whatsnew entry
DataFrame.__setitem__
does not work for unhashable objectiloc
does not work for unhashable objects for getitem and setitem