Skip to content

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

Merged
merged 2 commits into from
Dec 29, 2021
Merged

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 24, 2021

@phofl phofl marked this pull request as draft December 24, 2021 16:12
@@ -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):
Copy link
Contributor

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?

Copy link
Member Author

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

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

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)

@jreback jreback added Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves labels Dec 27, 2021
@phofl phofl marked this pull request as ready for review December 28, 2021 19:26
Copy link
Member

@mroeschke mroeschke left a 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

@phofl
Copy link
Member Author

phofl commented Dec 29, 2021

Not 100% sure, but wanted to add explicit checks as followups to raise a controlled error. Something we can reuse for the deprecated cases.

@jreback
Copy link
Contributor

jreback commented Dec 29, 2021

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

@jreback jreback merged commit 61e0eef into pandas-dev:master Dec 29, 2021
@jreback
Copy link
Contributor

jreback commented Dec 29, 2021

thanks @phofl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: .loc doesn't document that it can take sets or dicts as arguments
3 participants