Skip to content

Commit 0da6c41

Browse files
committed
catch zip
1 parent 6accf04 commit 0da6c41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/io/formats/csvs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from __future__ import print_function
77

88
import csv as csvlib
9+
from zipfile import ZipFile
910
import numpy as np
1011

1112
from pandas.core.dtypes.missing import notna
@@ -127,8 +128,9 @@ def save(self):
127128
else:
128129
encoding = self.encoding
129130

130-
if (not hasattr(self.path_or_buf, 'write') and
131-
self.compression == 'zip'):
131+
if (isinstance(self.path_or_buf, ZipFile) or
132+
(not hasattr(self.path_or_buf, 'write') and
133+
self.compression == 'zip')):
132134
is_zip = True
133135
else:
134136
is_zip = False

0 commit comments

Comments
 (0)