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.
Hint: You can set the default subtitles language 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.

Serializing Objects With the Python pickle Module (Summary)

You now know how to use the Python pickle module to convert an object hierarchy to a stream of bytes that can be saved to a disk or transmitted over a network. You also know that the deserialization process in Python must be used with care since unpickling something that comes from an untrusted source can be extremely dangerous.

In this course, you’ve learned:

  • What it means to serialize and deserialize an object
  • Which modules you can use to serialize objects in Python
  • Which kinds of objects can be serialized with the Python pickle module
  • How to use the Python pickle module to serialize object hierarchies
  • What the risks are of unpickling from an untrusted source

Download

Sample Code (.zip)

5.4 KB

Download

Course Slides (.pdf)

213.2 KB

Jon Nyquist on Dec. 24, 2020

I read an article on Medium suggesting breaking long Jupyter notebooks into smaller concerns with pickle to pass pandas dataframes between the notebooks.

df.to_pickle(PROCESSED_FILE)

Seems like an interesting idea.

Become a Member to join the conversation.