I have a spase matrix called X. How to I get the sparse first row, second row etc…
So, I know there should be 100 rows.
How do I do this loop?
for i in xrange(10):
X[i] = row I want
The row I want should also be sparse format.
Thanks
Thanks
X[i]is the row you want. It will be in sparse form already (although it would probably help if you’ve made it ascipy.sparse.csr_matrix). Typically we iterate over the rows of a matrix without the index, as simply:although if the index is necessary you can also write: