Division of sparse matrix
问题 I have a scipy.sparse matrix with 45671x45671 elements. In this matrix, some rows contain only '0' value. My question is, how to divide each row values by the row sum. Obviously, with for loop it's work, but I look for an efficient method... I already tried : matrix / matrix.sum(1) but I have MemoryError issue. matrix / scs.csc_matrix((matrix.sum(axis=1))) but ValueError: inconsistent shapes Other wacky things... Moreover, I want to skip rows with only '0' values. So, if you have any solution