xxxxxxxxxx
df.to_csv (r'C:\Users\John\Desktop\export_dataframe.csv', index = None, header=True)
xxxxxxxxxx
df.to_csv(r'Path where you want to store the exported CSV file\File Name.csv', index = False)
xxxxxxxxxx
import pandas as pd
# Assuming you have a dataframe called 'df'
df.to_csv('output.csv', index=False)
xxxxxxxxxx
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
df.to_csv('my_data.csv', index=False)
xxxxxxxxxx
>>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
'mask': ['red', 'purple'],
'weapon': ['sai', 'bo staff']})
>>> df.to_csv(index=False)