I am creating a very large array. Rather than having this array stored in memory, I want to be able to write it to a file. This needs to be in a format I can later import.
I would use pickle but it appears pickle is used for completed file structures.
In the following example, I need a way for the out variable to be a file rather than a memory stored object:
out = []
for x in y:
z = []
#get lots of data into z
out.append(z)
Take a look at streaming-pickle.
It’s actually just a single file with three short methods. I added a snippet with an example:
Here’s how you could use it: