Skip to content

Commit 67f010a

Browse files
committed
BUG: fixed errors in python2
1 parent 050e8b5 commit 67f010a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/io/common.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import csv
55
import codecs
66
import mmap
7-
import io
87
from contextlib import contextmanager, closing
98
import zipfile
109

@@ -395,7 +394,9 @@ def _get_handle(path_or_buf, mode, encoding=None, compression=None,
395394
elif is_path:
396395
if compat.PY2:
397396
# Python 2
398-
f = io.open(path_or_buf, mode, newline='\n')
397+
if mode == 'w':
398+
mode = 'wb'
399+
f = open(path_or_buf, mode)
399400
elif encoding:
400401
# Python 3 and encoding
401402
f = open(path_or_buf, mode, encoding=encoding, newline='\n')

0 commit comments

Comments
 (0)