Skip to content

Commit bd9b2af

Browse files
hsperrjreback
authored andcommitted
ENH: repr now shows index name pandas-dev#6482
1 parent cef3c85 commit bd9b2af

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/core/index.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,13 @@ def __unicode__(self):
412412
"""
413413
prepr = com.pprint_thing(self, escape_chars=('\t', '\r', '\n'),
414414
quote_strings=True)
415-
return "%s(%s, dtype='%s')" % (type(self).__name__, prepr, self.dtype)
415+
416+
name_attr=''
417+
if self.name:
418+
name_attr = u(" %s=%s,") % ('name', self.name)
419+
420+
return "%s(%s,%s dtype='%s')" % (type(self).__name__,
421+
prepr, name_attr, self.dtype)
416422

417423
def to_series(self, **kwargs):
418424
"""

0 commit comments

Comments
 (0)