Skip to content

Commit

Permalink
TST: python 3 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed Dec 9, 2012
1 parent 6a5b1f9 commit bf0c904
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pandas/io/tests/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ def _check_extension_indexlabels(self, ext):
os.remove(path)

def test_excel_roundtrip_indexname(self):
_skip_if_no_excelsuite()

path = '%s.xls' % tm.rands(10)

df = DataFrame(np.random.randn(10, 4))
Expand Down
9 changes: 8 additions & 1 deletion pandas/src/parser.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1017,11 +1017,18 @@ def _ensure_encoded(list lst):
if PyUnicode_Check(x):
x = PyUnicode_AsUTF8String(x)
elif not PyBytes_Check(x):
x = bytes(x)
x = asbytes(x)

result.append(x)
return result

cdef asbytes(object o):
if PY3:
return str(o).encode('utf-8')
else:
return str(o)


def _is_file_like(obj):
if PY3:
import io
Expand Down

0 comments on commit bf0c904

Please sign in to comment.