Python: how do you store a sparse matrix using python?

前端 未结 7 1827
灰色年华
灰色年华 2021-02-06 06:17

I have got an output using sparse matrix in python, i need to store this sparse matrix in my hard disk, how can i do it? if i should create a database then how should i do?? thi

7条回答
  •  一生所求
    2021-02-06 07:10

    Assuming you have a numpy matrix or ndarray, which your question and tags imply, there is a dump method and load function you can use:

    your_matrix.dump('output.mat')
    another_matrix = numpy.load('output.mat')
    

提交回复
热议问题