Locked learning resources

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

Unlock This Lesson

Locked learning resources

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

Unlock This Lesson

Reading and Writing Files With pandas (Summary)

You now know how to save the data and labels from pandas DataFrame objects to different kinds of files. You also know how to load your data from files and create DataFrame objects.

You’ve used the pandas read_csv() and .to_csv() methods to read and write CSV files. You also used similar methods to read and write Excel, JSON, HTML, SQL, and pickle files. These functions are very convenient and widely used. They allow you to save or load your data in a single function or method call.

You’ve also learned how to save time, memory, and disk space when working with large data files:

  • Compress or decompress files
  • Choose the rows and columns you want to load
  • Use less precise data types
  • Split data into chunks and process them one by one
Download

Sample Code (.zip)

33.8 KB
Download

Course Slides (.pdf)

11.6 MB
Avatar image for Steven Wolk

Steven Wolk on Aug. 19, 2021

I learned about Pandas and pickle files. You can really get into a pickle if you are not careful!

Avatar image for Carlo Barrientos

Carlo Barrientos on May 14, 2024

I liked learning about Chunks when going through big data. I liked learning that pandas can ‘infer’ compression from filename suffix.

Become a Member to join the conversation.