@@ -2878,7 +2878,7 @@ def from_csv(cls, path, sep=',', parse_dates=True, header=None,
2878
2878
2879
2879
return result
2880
2880
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 = '' ,
2882
2882
float_format = None , header = False , index_label = None ,
2883
2883
mode = 'w' , encoding = None , compression = None , date_format = None ,
2884
2884
decimal = '.' ):
@@ -2920,8 +2920,11 @@ def to_csv(self, path=None, index=True, sep=",", na_rep='',
2920
2920
"""
2921
2921
from pandas .core .frame import DataFrame
2922
2922
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 ,
2925
2928
float_format = float_format , header = header ,
2926
2929
index_label = index_label , mode = mode ,
2927
2930
encoding = encoding , compression = compression ,
0 commit comments