Skip to content

Commit c53b474

Browse files
FIX printing index with display.max_seq_items=None (GH10182)
1 parent 0aceb38 commit c53b474

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

doc/source/whatsnew/v0.17.0.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Bug Fixes
6161
~~~~~~~~~
6262

6363
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
64-
64+
- Bug in Index repr when using the ``max_seq_items=None`` setting (:issue:`10182`).
6565

6666
- Bug where Panel.from_dict does not set dtype when specified (:issue:`10058`)
6767
- Bug in ``Timestamp``'s' ``microsecond``, ``quarter``, ``dayofyear``, ``week`` and ``daysinmonth`` properties return ``np.int`` type, not built-in ``int``. (:issue:`10050`)
@@ -74,5 +74,3 @@ Bug Fixes
7474
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
7575

7676
- Bug in `Series.plot(label="LABEL")` not correctly setting the label (:issue:`10119`)
77-
78-

pandas/core/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def _format_data(self):
443443

444444
n = len(self)
445445
sep = ','
446-
max_seq_items = get_option('display.max_seq_items')
446+
max_seq_items = get_option('display.max_seq_items') or n
447447
formatter = self._formatter_func
448448

449449
# do we want to justify (only do so for non-objects)

pandas/tests/test_index.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ def test_str(self):
133133
self.assertTrue("'foo'" in str(idx))
134134
self.assertTrue(idx.__class__.__name__ in str(idx))
135135

136+
def test_repr_max_seq_item_setting(self):
137+
# GH10182
138+
idx = self.create_index()
139+
idx = idx.repeat(50)
140+
with pd.option_context("display.max_seq_items", None):
141+
repr(idx)
142+
self.assertFalse('...' in str(idx))
143+
136144
def test_wrong_number_names(self):
137145
def testit(ind):
138146
ind.names = ["apple", "banana", "carrot"]

0 commit comments

Comments
 (0)