We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d968508 commit 95678ebCopy full SHA for 95678eb
pandas/core/index.py
@@ -12,6 +12,7 @@
12
import pandas.lib as lib
13
import pandas._algos as _algos
14
from pandas.lib import Timestamp
15
+from pandas.util import py3compat
16
17
__all__ = ['Index']
18
@@ -132,12 +133,11 @@ def _shallow_copy(self):
132
133
return self.view()
134
135
def __repr__(self):
- try:
136
- result = np.ndarray.__repr__(self)
137
- except UnicodeEncodeError:
138
- result = 'Index([%s])' % (', '.join([repr(x) for x in self]))
139
-
140
- return result
+ if py3compat.PY3:
+ prepr = com.pprint_thing(self)
+ else:
+ prepr = com.pprint_thing_encoded(self)
+ return 'Index(%s, dtype=%s)' % (prepr,self.dtype)
141
142
def astype(self, dtype):
143
return Index(self.values.astype(dtype), name=self.name,
0 commit comments