[SciPy-User] saving a sparse matrix to file

Nathaniel Smith njs@pobox....
Mon Jun 25 15:34:39 CDT 2012

On Mon, Jun 25, 2012 at 7:34 PM, Pengkui Luo <pengkui.luo@gmail.com> wrote:
> Is there a unified API to save a sparse matrix of any type (dok, lil, csc,
> ...) to file, as simple as pickle dump/load?

If you want a pickle, have you tried using Python's generic pickle
dump/load interface?

import cPickle
cPickle.dump(myobj, open("myfile.pickle", "w"))
myobj2 = cPickle.load(open("myfile.pickle"))



More information about the SciPy-User mailing list