Skip to content

Commit 9be7985

Browse files
committed
CLN: Deprecate Index.summary (GH18217)
Review code changes
1 parent f4c52e4 commit 9be7985

File tree

5 files changed

+12
-27
lines changed

5 files changed

+12
-27
lines changed

pandas/core/frame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ def __getitem__(self, key):
23412341
try:
23422342
if key in self.columns and not is_mi_columns:
23432343
return self._getitem_column(key)
2344-
except Exception:
2344+
except:
23452345
pass
23462346

23472347
# see if we can slice the rows
@@ -2843,7 +2843,7 @@ def _ensure_valid_index(self, value):
28432843
if not len(self.index) and is_list_like(value):
28442844
try:
28452845
value = Series(value)
2846-
except Exception:
2846+
except:
28472847
raise ValueError('Cannot set a frame with no defined index '
28482848
'and a value that cannot be converted to a '
28492849
'Series')
@@ -6828,7 +6828,7 @@ def convert(v):
68286828
values = np.array([convert(v) for v in values])
68296829
else:
68306830
values = convert(values)
6831-
except Exception:
6831+
except:
68326832
values = convert(values)
68336833

68346834
else:

pandas/core/indexes/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,11 @@ def _has_complex_internals(self):
13861386
return False
13871387

13881388
def _summary(self, name=None):
1389+
"""
1390+
Return a summarized representation
1391+
.. deprecated:: 0.23.0
1392+
No longer supported
1393+
"""
13891394
if len(self) > 0:
13901395
head = self[0]
13911396
if (hasattr(head, 'format') and
@@ -1406,6 +1411,7 @@ def _summary(self, name=None):
14061411

14071412
def summary(self, name=None):
14081413
"""
1414+
Return a summarized representation
14091415
.. deprecated:: 0.23.0
14101416
No longer supported
14111417
"""

pandas/core/indexes/datetimelike.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,9 @@ def where(self, cond, other=None):
10511051

10521052
def _summary(self, name=None):
10531053
"""
1054-
return a summarized representation
1054+
Return a summarized representation
1055+
.. deprecated:: 0.23.0
1056+
No longer supported
10551057
"""
10561058
formatter = self._formatter_func
10571059
if len(self) > 0:
@@ -1071,15 +1073,6 @@ def _summary(self, name=None):
10711073
result = result.replace("'", "")
10721074
return result
10731075

1074-
def summary(self, name=None):
1075-
"""
1076-
.. deprecated:: 0.23.0
1077-
No longer supported
1078-
"""
1079-
warnings.warn("'summary' is deprecated and will be removed in a "
1080-
"future version.", FutureWarning, stacklevel=2)
1081-
return self._summary(name)
1082-
10831076
def _concat_same_dtype(self, to_concat, name):
10841077
"""
10851078
Concatenate to_concat which has the same class

pandas/tests/indexes/period/test_formats.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,3 @@ def test_summary(self):
207207
exp6, exp7, exp8, exp9]):
208208
result = idx._summary()
209209
assert result == expected
210-
211-
def test_summary_deprecated(self):
212-
# GH18217
213-
idx = PeriodIndex(['2011-01-01'], freq='D')
214-
215-
with tm.assert_produces_warning(FutureWarning):
216-
idx.summary()

pandas/tests/indexes/timedeltas/test_formats.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import pandas as pd
66
from pandas import TimedeltaIndex
77

8-
import pandas.util.testing as tm
9-
108

119
class TestTimedeltaIndexRendering(object):
1210
@pytest.mark.parametrize('method', ['__repr__', '__unicode__', '__str__'])
@@ -69,11 +67,6 @@ def test_representation_to_series(self):
6967
result = repr(pd.Series(idx))
7068
assert result == expected
7169

72-
def test_summary_deprecated(self):
73-
idx = TimedeltaIndex([], freq='D')
74-
with tm.assert_produces_warning(FutureWarning):
75-
idx.summary()
76-
7770
def test_summary(self):
7871
# GH#9116
7972
idx1 = TimedeltaIndex([], freq='D')

0 commit comments

Comments
 (0)