### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.12 Reference Guide (DRAFT) »
- Sparse matrices (`scipy.sparse`) »
- scipy.sparse.coo_matrix »

# scipy.sparse.coo_matrix.tocsr

`coo_matrix.``tocsr`()

  Return a copy of this matrix in Compressed Sparse Row format

  Duplicate entries will be summed together.

  Examples

      >>> from numpy import array
      >>> from scipy.sparse import coo_matrix
      >>> row  = array([0,0,1,3,1,0,0])
      >>> col  = array([0,2,1,3,1,0,0])
      >>> data = array([1,1,1,1,1,1,1])
      >>> A = coo_matrix( (data,(row,col)), shape=(4,4)).tocsr()
      >>> A.todense()
      matrix([[3, 0, 1, 0],
              [0, 2, 0, 0],
              [0, 0, 0, 0],
              [0, 0, 0, 1]])

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.12 Reference Guide (DRAFT) »
- Sparse matrices (`scipy.sparse`) »
- scipy.sparse.coo_matrix »