File tree 1 file changed +12
-10
lines changed
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 3
3
from StringIO import StringIO
4
4
from pandas .core .common import adjoin , isnull , _format
5
5
from pandas .core .index import MultiIndex , _ensure_index
6
+ from pandas .util import py3compat
6
7
7
8
import pandas .core .common as com
8
9
import numpy as np
@@ -209,17 +210,18 @@ def to_string(self, force_unicode=False):
209
210
else :
210
211
to_write .append (adjoin (1 , * stringified ))
211
212
212
- if force_unicode :
213
- to_write = [unicode (s ) for s in to_write ]
214
- else :
215
- # generally everything is plain strings, which has ascii encoding.
216
- # problem is when there is a char with value over 127 - everything
217
- # then gets converted to unicode.
218
- try :
219
- for s in to_write :
220
- str (s )
221
- except UnicodeError :
213
+ if not py3compat .PY3 :
214
+ if force_unicode :
222
215
to_write = [unicode (s ) for s in to_write ]
216
+ else :
217
+ # generally everything is plain strings, which has ascii encoding.
218
+ # problem is when there is a char with value over 127 - everything
219
+ # then gets converted to unicode.
220
+ try :
221
+ for s in to_write :
222
+ str (s )
223
+ except UnicodeError :
224
+ to_write = [unicode (s ) for s in to_write ]
223
225
224
226
self .buf .writelines (to_write )
225
227
You can’t perform that action at this time.
0 commit comments