Writing CSVs With Pandas
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')
Take the Quiz: Test your knowledge with our interactive “Reading and Writing CSV Files in Python” quiz. Upon completion you will receive a score so you can track your learning progress over time:
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment below and let us know.
Comments & Discussion
Become a Member to join the conversation.