Skip to content

Commit 7567b65

Browse files
author
y-p
committed
BUG: Add checks to df,series repr() to handle python3
1 parent 6677d39 commit 7567b65

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

pandas/core/format.py

+2
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ def to_string(self):
134134
if footer:
135135
result.append(footer)
136136

137+
if py3compat.PY3:
138+
return unicode(u'\n'.join(result))
137139
return com.console_encode(u'\n'.join(result))
138140

139141
if py3compat.PY3: # pragma: no cover

pandas/core/frame.py

+3
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ def __repr__(self):
584584
else:
585585
self.to_string(buf=buf)
586586
value = buf.getvalue()
587+
588+
if py3compat.PY3:
589+
return unicode(value)
587590
return com.console_encode(value)
588591

589592
def _repr_html_(self):

pandas/core/series.py

+2
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,8 @@ def __repr__(self):
848848
else:
849849
result = '%s' % ndarray.__repr__(self)
850850

851+
if py3compat.PY3:
852+
return unicode(result)
851853
return com.console_encode(result)
852854

853855
def _tidy_repr(self, max_vals=20):

0 commit comments

Comments
 (0)