From the docs for coo_matrix:
| Intended Usage
| - COO is a fast format for constructing sparse matrices
| - Once a matrix has been constructed, convert to CSR or
| CSC format for fast arithmetic and matrix vector operations
| - By default when converting to CSR or CSC format, duplicate (i,j)
| entries will be summed together. This facilitates efficient
| construction of finite element matrices and the like. (see example)
And indeed, csr_matrix
supports the indexing in an expected way:
>>> from scipy.sparse import coo_matrix
>>> m = coo_matrix([[1, 2, 3], [4, 5, 6]])
>>> m1 = m.tocsr()
>>> m1[1, 2]
6
>>> m1
<2x3 sparse matrix of type '<type 'numpy.int64'>'
with 6 stored elements in Compressed Sparse Row format>
(The way I found the above quote from the docs was >>> help(m)
which is equivalent to the online docs).