Skip to content

Commit c3a76d0

Browse files
committed
inherit _format_attrs and _format_space
1 parent bba70b2 commit c3a76d0

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

pandas/core/indexes/multi.py

-15
Original file line numberDiff line numberDiff line change
@@ -615,21 +615,6 @@ def _formatter_func(self, tup):
615615
formatter_funcs = [level._formatter_func for level in self.levels]
616616
return tuple(func(val) for func, val in zip(formatter_funcs, tup))
617617

618-
def _format_attrs(self):
619-
"""
620-
Return a list of tuples of the (attr,formatted_value)
621-
"""
622-
attrs = [('dtype', "'{}'".format(self.dtype))]
623-
if self.names is not None and any(self.names):
624-
attrs.append(('names', default_pprint(self.names)))
625-
max_seq_items = get_option('display.max_seq_items') or len(self)
626-
if len(self) > max_seq_items:
627-
attrs.append(('length', len(self)))
628-
return attrs
629-
630-
def _format_space(self):
631-
return " "
632-
633618
def _format_data(self, name=None):
634619
"""
635620
Return the formatted data as a unicode string

pandas/io/formats/printing.py

+2
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ def format_object_attrs(obj):
467467
attrs.append(('dtype', "'{}'".format(obj.dtype)))
468468
if getattr(obj, 'name', None) is not None:
469469
attrs.append(('name', default_pprint(obj.name)))
470+
elif getattr(obj, 'names', None) is not None and any(obj.names):
471+
attrs.append(('names', default_pprint(obj.names)))
470472
max_seq_items = get_option('display.max_seq_items') or len(obj)
471473
if len(obj) > max_seq_items:
472474
attrs.append(('length', len(obj)))

0 commit comments

Comments
 (0)