Skip to content

Commit b7b9a09

Browse files
committed
CLN: Change path argument name to path_or_buf
This way, the Series.to_csv naming convention for this argument will conform to the DataFrame.to_csv naming convention.
1 parent c8d8331 commit b7b9a09

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/core/series.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,7 +2878,7 @@ def from_csv(cls, path, sep=',', parse_dates=True, header=None,
28782878

28792879
return result
28802880

2881-
def to_csv(self, path=None, index=True, sep=",", na_rep='',
2881+
def to_csv(self, path_or_buf=None, index=True, sep=",", na_rep='',
28822882
float_format=None, header=False, index_label=None,
28832883
mode='w', encoding=None, compression=None, date_format=None,
28842884
decimal='.'):
@@ -2920,8 +2920,11 @@ def to_csv(self, path=None, index=True, sep=",", na_rep='',
29202920
"""
29212921
from pandas.core.frame import DataFrame
29222922
df = DataFrame(self)
2923-
# result is only a string if no path provided, otherwise None
2924-
result = df.to_csv(path, index=index, sep=sep, na_rep=na_rep,
2923+
2924+
# ensure backwards compatibility with path argument
2925+
path_or_buf = kwargs.pop('path', path_or_buf)
2926+
# result is only a string if no path_or_buf provided, otherwise None
2927+
result = df.to_csv(path_or_buf, index=index, sep=sep, na_rep=na_rep,
29252928
float_format=float_format, header=header,
29262929
index_label=index_label, mode=mode,
29272930
encoding=encoding, compression=compression,

0 commit comments

Comments
 (0)