-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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: Deprecate Index.summary (GH18217) #20028
CLN: Deprecate Index.summary (GH18217) #20028
Conversation
pandas/core/frame.py
Outdated
@@ -2185,7 +2185,7 @@ def __getitem__(self, key): | |||
try: | |||
if key in self.columns and not is_mi_columns: | |||
return self._getitem_column(key) | |||
except: | |||
except Exception: |
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.
either leave these (IOW the linter is not actually failing these on CI), or catch a specific exception
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.
I had added Exception here so that they were PEP8 compliant. (no empty except). I can change this back if we're not concerned about these failing the flake8 / PEP8 check.
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.
they r not PEP compliant but we have this particular check turned off ATM because otherwise a large number of these would fail
they need fixing but generally want to catch specific exceptions rather than Exception (if we can help it)
pandas/core/indexes/datetimelike.py
Outdated
@@ -963,6 +963,15 @@ def summary(self, name=None): | |||
result = result.replace("'", "") | |||
return result | |||
|
|||
def summary(self, name=None): |
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 only need to deprecate in base class one (the sub-class is the same)
@@ -941,7 +941,7 @@ def where(self, cond, other=None): | |||
return self._shallow_copy(result, | |||
**self._get_attributes_dict()) | |||
|
|||
def summary(self, name=None): | |||
def _summary(self, name=None): | |||
""" |
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 you update the doc-strings here (and in the base class)
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.
@jreback - What specific updates were you referring to? Do the sphinx tags need to be added 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.
don't need deprecated in the _summary doc-strings
@@ -67,6 +69,11 @@ def test_representation_to_series(self): | |||
result = repr(pd.Series(idx)) | |||
assert result == expected | |||
|
|||
def test_summary_deprecated(self): |
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.
this is not necessary
assert result == expected | ||
|
||
def test_summary_deprecated(self): | ||
# GH18217 |
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.
@jreback - Should this be removed as well since the timedeltas version is being removed and it should be taken care of in the base test case?
can you rebase and update according to comments. |
Review code changes
5a2d31b
to
9be7985
Compare
Codecov Report
@@ Coverage Diff @@
## master #20028 +/- ##
==========================================
+ Coverage 91.76% 91.77% +0.01%
==========================================
Files 150 152 +2
Lines 49151 49178 +27
==========================================
+ Hits 45102 45133 +31
+ Misses 4049 4045 -4
Continue to review full report at Codecov.
|
def summary(self, name=None): | ||
def _summary(self, name=None): | ||
""" | ||
Return a summarized representation |
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 don't need a deprecated tag on the _summary
methods
@@ -1404,6 +1409,16 @@ def summary(self, name=None): | |||
name = type(self).__name__ | |||
return '%s: %s entries%s' % (name, len(self), index_summary) | |||
|
|||
def summary(self, name=None): | |||
""" | |||
Return a summarized representation |
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 you add a Parameters & Returns section
@@ -941,7 +941,7 @@ def where(self, cond, other=None): | |||
return self._shallow_copy(result, | |||
**self._get_attributes_dict()) | |||
|
|||
def summary(self, name=None): | |||
def _summary(self, name=None): | |||
""" |
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.
don't need deprecated in the _summary doc-strings
Update docstrings
minor comment. ping when pushed. |
pandas/core/indexes/base.py
Outdated
""" | ||
Return a summarized representation | ||
.. deprecated:: 0.23.0 | ||
No longer supported |
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 don't need the 'No longer supported'
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.
@jreback - This has been removed per your request. Update has been pushed.
Minor docstring tweaks
thanks @GGordonGordon |
git diff upstream/master -u -- "*.py" | flake8 --diff