c = []
for i in sum_of_col:
    for j in i:
        if math.fabs(j) < minf:
            c.append(0)
else:
    c.append(1 / j)
print(c)
B = sp.lil_matrix((5, 5))
B.setdiag(c)
print(B.todense())
C = A * B
print(C.todense())
C = C.T
print(C.todense())
Efficient way to normalize a Scipy Sparse Matrix