We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ddf563 commit ce719fdCopy full SHA for ce719fd
pandas/io/formats/format.py
@@ -1046,12 +1046,14 @@ def to_csv(
1046
"""
1047
from pandas.io.formats.csvs import CSVFormatter
1048
1049
- created_buffer = path_or_buf is None
1050
- if created_buffer:
+ if path_or_buf is None:
+ created_buffer = True
1051
path_or_buf = StringIO()
1052
+ else:
1053
+ created_buffer = False
1054
1055
csv_formatter = CSVFormatter(
- path_or_buf=path_or_buf, # type: ignore[arg-type]
1056
+ path_or_buf=path_or_buf,
1057
line_terminator=line_terminator,
1058
sep=sep,
1059
encoding=encoding,
0 commit comments