How to Export Data Frame in Jupyter as a Csv File

I have a data frame saved as df in a jupyter notebook, and i want to export it into a csv file on my desktop.

1

2 Answers

For a pandas data frame you can use df.to_csv('data.csv').

2

If you have data in pandas DataFrame then you can use .to_csv() function from pandas to export your data in CSV .

Here's how you can save data in desktop

df.to_csv("<path to desktop and filename>")

# If you just use file name then it will save CSV file in working directory.
# Example path : C:/Users/<>/Desktop/<file name>.csv

If you want to learn more about it you can visit official documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest