to_csv¶
- DataFrame.to_csv(filepath, delimiter=',', format=None, date_format=None, float_format=None, index=True)¶
Save the data to an csv file.
- Parameters
filename – (string) The file name.
delimiter – (string) Field delimiter character. Default is
,
.format – (string) Format string.
date_format – (string) Date format string. i.e. ‘yyyyMMddHH’.
float_format – (string) Float format string. i.e. ‘%.2f’.
index – (boolean) Write index or not.
Examples:
df = DataFrame({'name': ['Raphael', 'Donatello'], 'mask': ['red', 'purple'], 'weapon': ['sai', 'bo staff']}) df.to_csv('D:/Test/out.csv')