Skip to content

Commit 3288691

Browse files
committed
writing zip compression not supported in Python 2
1 parent 80992a3 commit 3288691

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/io/common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,11 @@ def _get_handle(path_or_buf, mode, encoding=None, compression=None,
366366
elif compression == 'zip':
367367
zf = BytesZipFile(path_or_buf, mode)
368368
if zf.mode == 'w':
369-
f = zf
369+
if compat.PY3:
370+
f = zf
371+
elif compat.PY2:
372+
raise NotImplementedError('Writing zip compression is not'
373+
' supported in Python 2.')
370374
elif zf.mode == 'r':
371375
zip_names = zf.namelist()
372376
if len(zip_names) == 1:

0 commit comments

Comments
 (0)