Exporting a DataFrame to a CSV File

CSV File

To save a DataFrame as a CSV file, we can use the built-in Pandas df.to_csv() method is a built-in function in Pandas that allows you to save a Pandas DataFrame as a CSV file.

df.to_csv('filename.csv', sep=',', index=False)

Excel File

df.to_excel("filename.xlsx", sheet_name='sheet1',... )

# Name of sheet which will contain the DataFrame

JSON File

df.to_json('filename.json')
Powered by Forestry.md