Skip to content

Commit 439316f

Browse files
author
y-p
committed
BUG: don't rely on sys.getdefaultencoding if we don't need to GH3360
1 parent 5bf8adb commit 439316f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/format.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ def _encode_diff_func():
165165
encoding = get_option("display.encoding")
166166

167167
def _encode_diff(x):
168-
return len(x) - len(x.decode(encoding))
168+
if not isinstance(x,unicode):
169+
return len(x) - len(x.decode(encoding))
170+
return 0
169171

170172
return _encode_diff
171173

0 commit comments

Comments
 (0)