Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Module « scipy.sparse »

Fonction vstack - module scipy.sparse

Signature de la fonction vstack

def vstack(blocks, format=None, dtype=None) 

Description

help(scipy.sparse.vstack)

Stack sparse arrays vertically (row wise)

Parameters
----------
blocks
    sequence of sparse arrays with compatible shapes
format : str, optional
    sparse format of the result (e.g., "csr")
    by default an appropriate sparse array format is returned.
    This choice is subject to change.
dtype : dtype, optional
    The data-type of the output array. If not given, the dtype is
    determined from that of `blocks`.

Returns
-------
new_array : sparse 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]])



Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé