print dataframe to csv python code example
Example 1: python save df to csv
df.to_csv(r'/directory/path/file_name.csv', index = False, header = True)
Example 2: df to csv
>>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
... 'mask': ['red', 'purple'],
... 'weapon': ['sai', 'bo staff']})
>>> df.to_csv(index=False)