Skip to content

Commit 43c6c79

Browse files
committed
accept filehandle for to_csv compression
1 parent c85ab08 commit 43c6c79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/io/formats/csvs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ def save(self):
154154
# GH 17778 handles compression for byte strings.
155155
if not close and self.compression:
156156
f.close()
157-
with open(self.path_or_buf, 'r') as f:
157+
with open(f.name, 'r') as f:
158158
data = f.read()
159-
f, handles = _get_handle(self.path_or_buf, self.mode,
159+
f, handles = _get_handle(f.name, self.mode,
160160
encoding=encoding,
161161
compression=self.compression)
162162
f.write(data)

0 commit comments

Comments
 (0)