JGuizard
6/28/2016 - 3:32 PM

Store and retrieve objects in memory with joblib

Store and retrieve objects in memory with joblib

from tempfile import mkdtemp
savedir = mkdtemp()
import os
filename = os.path.join(savedir, 'test.pkl')

import numpy as np
to_persist = [('a', [1, 2, 3]), ('b', np.arange(10))]

import joblib
joblib.dump(to_persist, filename)  
joblib.load(filename)