A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.vstack.html below:

vstack — SciPy v1.16.1 Manual

scipy.sparse.

vstack#
scipy.sparse.vstack(blocks, format=None, dtype=None)[source]#

Stack sparse arrays vertically (row wise)

Parameters:
blocks

sequence of sparse arrays with compatible shapes

formatstr, optional

sparse format of the result (e.g., “csr”) by default an appropriate sparse array format is returned. This choice is subject to change.

dtypedtype, optional

The data-type of the output array. If not given, the dtype is determined from that of blocks.

Returns:
new_arraysparse matrix or array

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(vstack(blocks)) or convert one block e.g. blocks[0] = csr_array(blocks[0]).

See also

hstack

stack sparse matrices horizontally (column wise)

Examples

>>> from scipy.sparse import coo_array, vstack
>>> A = coo_array([[1, 2], [3, 4]])
>>> B = coo_array([[5, 6]])
>>> vstack([A, B]).toarray()
array([[1, 2],
       [3, 4],
       [5, 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