Daily Dose of Data Science

Share this post

Lesser-known feature of Pickle Files

www.blog.dailydoseofds.com

Lesser-known feature of Pickle Files

Avi Chawla
Dec 2, 2022
1
Share

Pickles are widely used to dump data objects to disk. But folks often dump just a single object into a pickle file. Moreover, one creates multiple pickles to store multiple objects.

However, did you know that you can store as many objects as you want within a single pickle file? What's more, when reloading, it is not necessary to load all the objects.

Just make sure to dump the objects within the same context manager (using 𝐰𝐢𝐭𝐡).

Of course, one solution is to store the objects together as a tuple. But while reloading, the entire tuple will be loaded. This may not be desired in some cases.

Share this Post on LinkedIn: Post Link.

Thanks for reading Daily Dose of Data Science! Subscribe for free to receive new posts and support my work.


Daily Dose of Data Science is now also available on GitHub 😃 🎉!

In this Repository, you can find the notebooks/datasets/videos corresponding to each and every post that I have shared as daily tips in this publication.

The tips have been neatly organized into categories to make it easier for exploration purposes. Moreover, I have provided links to my Medium articles (if any) for an in-depth understanding on that particular topic.

I would really appreciate it if you could star the repository and share it with someone who can benefit from this :)

Repository Link: Daily Dose of Data Science

Thanks for being a member of the Daily Dose of Data Science 😊.


I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.

1
Share
Previous
Next
Comments
Top
New
Community

No posts

Ready for more?

© 2023 Avi Chawla
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing