简体   繁体   中英

How to write a uint8 numpy array to compact file?

I want to save a large uint8 numpy array for use later. How can I do that using the least amount of storage possible?

Edit : Encoding the file in UTF-8 or ASCII makes the file way larger than it needs to be.

Numpy's save_compressed will save the array into a npz file using zip compression.

Apart from being compressed, it allows you also to save multiple arrays into the same file which might help you to save some space as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM