-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
CLN: pandas/core/indexing.py #36713
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
CLN: pandas/core/indexing.py #36713
Conversation
pandas/core/indexing.py
Outdated
@@ -834,11 +831,9 @@ def _getitem_nested_tuple(self, tup: Tuple): | |||
if self.name != "loc": | |||
# This should never be reached, but lets be explicit about it | |||
raise ValueError("Too many indices") | |||
try: | |||
with suppress(IndexingError): | |||
result = self._handle_lowerdim_multi_index_axis0(tup) | |||
return result |
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.
You could avoid the declaration of result 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.
Thank you! Changed.
pandas/core/indexing.py
Outdated
@@ -782,14 +782,11 @@ def _getitem_lowerdim(self, tup: Tuple): | |||
# ...but iloc should handle the tuple as simple integer-location | |||
# instead of checking it as multiindex representation (GH 13797) | |||
if isinstance(ax0, ABCMultiIndex) and self.name != "iloc": | |||
try: | |||
with suppress(IndexingError): | |||
result = self._handle_lowerdim_multi_index_axis0(tup) | |||
return result |
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 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.
Did that
LGTM pending green. If you're looking for high-value things to do in this file, narrowing what we're catching/suppressing is a never-ending battle. |
Lgtm |
Can anyone re-start CI? Looks like there were internal CI engine failures. |
thanks @ivanovmg nice cleanup |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Slight clean-up of
pandas/core/indexing.py
.suppress
instead oftry/except/pass
(starting from Python 3.7)_validate_key_length