dataframe to csv automatically convert string code example
Example 1: save dataframe to csv
df.to_csv(file_name, sep='\t')
Example 2: df to csv
>>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
... 'mask': ['red', 'purple'],
... 'weapon': ['sai', 'bo staff']})
>>> df.to_csv(index=False)