How do you edit cells in a sparse matrix using scipy?
问题 I'm trying to manipulate some data in a sparse matrix. Once I've created one, how do I add / alter / update values in it? This seems very basic, but I can't find it in the documentation for the sparse matrix classes, or on the web. I think I'm missing something crucial. This is my failed attempt to do so the same way I would a normal array. >>> from scipy.sparse import bsr_matrix >>> A = bsr_matrix((10,10)) >>> A[5][7] = 6 Traceback (most recent call last): File "<pyshell#11>", line 1, in