Skip to content

Commit 5570139

Browse files
committed
more fixes
1 parent b2f287b commit 5570139

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

doc/source/whatsnew/v0.16.1.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ Highlights include:
1212
- Support for a ``CategoricalIndex``, a category based index, see :ref:`here <whatsnew_0161.enhancements.categoricalindex>`
1313
- New section on how-to-contribute to *pandas*, see :ref:`here <contributing>`
1414
- Revised "Merge, join, and concatenate" documentation including graphical examples to make it easier to understand each operations, see :ref:`here <merging>`
15-
15+
- The default ``Index`` printing has changed to a more uniform format, see :ref:`here <whatsnew_0161.index_repr>`
1616
- New method ``sample`` for drawing random samples from Series, DataFrames and Panels. See :ref:`here <whatsnew_0161.enchancements.sample>`
17-
18-
- ``BusinessHour`` offset is supported, see :ref:`here <timeseries.businesshour>`
17+
- ``BusinessHour`` datetime-offset is now supported, see :ref:`here <timeseries.businesshour>`
1918

2019
- Further enhancement to the ``.str`` accessor to make string operations easier, see :ref:`here <whatsnew_0161.enhancements.string>`
2120

@@ -288,8 +287,10 @@ New Behavior
288287

289288
pd.get_option('max_seq_items')
290289
pd.Index(range(4),name='foo')
290+
pd.Index(range(25),name='foo')
291291
pd.Index(range(104),name='foo')
292292
pd.date_range('20130101',periods=4,name='foo',tz='US/Eastern')
293+
pd.date_range('20130101',periods=25,name='foo',tz='US/Eastern')
293294
pd.date_range('20130101',periods=104,name='foo',tz='US/Eastern')
294295

295296
.. _whatsnew_0161.performance:

pandas/core/index.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ def _format_data(self):
434434
"""
435435
Return the formatted data as a unicode string
436436
"""
437-
space1 = "\n%s" % (' ' * (len(self.__class__.__name__) + 2))
438-
space2 = "\n%s" % (' ' * (len(self.__class__.__name__) + 1))
437+
space1 = "\n%s" % (' ' * (len(self.__class__.__name__) + 1))
438+
space2 = "\n%s" % (' ' * (len(self.__class__.__name__) + 2))
439439

440440
sep = ','
441441
max_seq_items = get_option('display.max_seq_items')
@@ -448,7 +448,7 @@ def best_rows(values, max_len):
448448
from pandas.core.format import get_console_size
449449
display_width, _ = get_console_size()
450450
if display_width is None:
451-
display_width = 80
451+
display_width = get_option('display.width')
452452
n_per_row = (display_width - len(self.__class__.__name__) - 2) // max_len
453453
n_rows = int(ceil(len(values) / float(n_per_row)))
454454
return n_per_row, n_rows
@@ -460,7 +460,7 @@ def best_fit(values, max_len, justify=False):
460460

461461
# adjust all values to max length if we have multi-lines
462462
if n_rows > 1 or justify:
463-
values = [x.rjust(max_len) for x in values]
463+
values = [values[0].rjust(max_len-2)] + [x.rjust(max_len-1) for x in values[1:]]
464464
sep_elements = sep
465465
else:
466466
sep_elements = sep + ' '
@@ -493,10 +493,10 @@ def best_fit(values, max_len, justify=False):
493493

494494
summary = '['
495495
summary += best_fit(head, max_len, justify=True)
496-
summary += space1 + ' ...' + space1
496+
summary += ',' + space1 + ' ...' + space2
497497
summary += best_fit(tail, max_len, justify=True)
498498
summary += '],'
499-
summary += space2
499+
summary += space1
500500

501501
else:
502502
values = [ formatter(x) for x in self ]
@@ -508,7 +508,7 @@ def best_fit(values, max_len, justify=False):
508508
summary += best_fit(values, max_len)
509509
summary += '],'
510510
if n_rows > 1:
511-
summary += space2
511+
summary += space1
512512
else:
513513
summary += ' '
514514

0 commit comments

Comments
 (0)