Skip to content

Commit f94722b

Browse files
author
Oleh Kozynets
committed
Merge branch 'master' into issue-36596
2 parents 39ef89b + ce719fd commit f94722b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pandas/io/formats/format.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1046,12 +1046,14 @@ def to_csv(
10461046
"""
10471047
from pandas.io.formats.csvs import CSVFormatter
10481048

1049-
created_buffer = path_or_buf is None
1050-
if created_buffer:
1049+
if path_or_buf is None:
1050+
created_buffer = True
10511051
path_or_buf = StringIO()
1052+
else:
1053+
created_buffer = False
10521054

10531055
csv_formatter = CSVFormatter(
1054-
path_or_buf=path_or_buf, # type: ignore[arg-type]
1056+
path_or_buf=path_or_buf,
10551057
line_terminator=line_terminator,
10561058
sep=sep,
10571059
encoding=encoding,

0 commit comments

Comments
 (0)