### Navigation

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

# scipy.sparse.hstack

`scipy.sparse.``hstack`(blocks, format=None, dtype=None)

  Stack sparse matrices horizontally (column wise)

  Parameters : | blocks : sequence of sparse matrices with compatible shapes format : string sparse format of the result (e.g. “csr”) by default an appropriate sparse matrix format is returned. This choice is subject to change.

  See also

  `vstack`
    stack sparse matrices vertically (row wise)

  Examples

      >>> from scipy.sparse import coo_matrix, vstack
      >>> A = coo_matrix([[1,2],[3,4]])
      >>> B = coo_matrix([[5],[6]])
      >>> hstack( [A,B] ).todense()
      matrix([[1, 2, 5],
              [3, 4, 6]])

### Navigation

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