Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Writing CSVs With Pandas

Give Feedback

In this lesson, you’ll cover how to use pandas to write data to CSV files. Here is a code sample that demonstrates how to add a new employee to a CSV file from the previous lesson:

data_frame.loc['Cookie Cat'] = ['2016-07-04', 20000.0, 0]
data_frame.to_csv('hrdata.csv')

Download

Sample CSV Files (.zip)

643 bytes

Comments & Discussion

Anonymous on June 17, 2019

Very helpful information. Thank you!

Sandhya on Feb. 13, 2020

Very helpful. Thanks.

Indran Naidoo on March 12, 2020

Thank you for a succinct walkthrough.

Joel on April 15, 2020

good job, must look deeper into pandas regarding not “hard-coding” the data in the python code

sroux53 on May 13, 2020

Excellent !

Kasidis Satangmongkol on June 10, 2020

Thank you very much! Great course, love your style of teaching, very easy to follow ;)

Become a Member to join the conversation.