I'm trying to figure out how to iterate through a scipy sparse matrix by column. I'm trying to compute the sum of each column, then weight the members of that column by that sum. What I want to do is basically:
for i=0 to #columns
for j=0 to #rows
sum=sum+matrix[i,j]
for j=0to #rows
matrix[i,j]=matrix[i,j]/sum
All of the iterators I've seen in examples iterate over the entire matrix at once instead of doing it per column. Is there a way to do what I'm trying to do?