scipy.sparse.
hstack#Stack sparse matrices horizontally (column wise)
sequence of sparse matrices with compatible shapes
sparse format of the result (e.g., âcsrâ) by default an appropriate sparse matrix format is returned. This choice is subject to change.
The data-type of the output matrix. If not given, the dtype is determined from that of blocks.
If any block in blocks is a sparse array, return a sparse array. Otherwise return a sparse matrix.
If you want a sparse array built from blocks that are not sparse arrays, use block(hstack(blocks))
or convert one block e.g. blocks[0] = csr_array(blocks[0])
.
See also
vstack
stack sparse matrices vertically (row wise)
Examples
>>> from scipy.sparse import coo_matrix, hstack >>> A = coo_matrix([[1, 2], [3, 4]]) >>> B = coo_matrix([[5], [6]]) >>> hstack([A,B]).toarray() array([[1, 2, 5], [3, 4, 6]])
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4