DataFrame.to_csv(path_or_buf=None, sep=',', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, mode='w', encoding=None, compression='infer', quoting=None, quotechar='"', line_terminator=None, chunksize=None, date_format=None, doublequote=True, escapechar=None, decimal='.', errors='strict')[source]
对象写入一个逗号分隔值(csv)文件。
版本0.24.0中的更改:更改了系列参数的顺序
参数:path_or_buf :str 或 file handle,
默认为 None
文件路径或对象,如果没有提供,
结果将作为字符串返回。
如果一个文件对象被传递,
它应该用newline= "来打开,
禁用通用换行符。
在版本0.24.0中更改:以前为Series命名为“path”。
sep :str,默认‘,’
长度为1的字符串。输出文件的字段分隔符。
na_rep :str,默认为 ‘’
缺失的数据表示。
float_format:str