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 ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Module « scipy.sparse.csgraph »

Fonction csgraph_to_masked - module scipy.sparse.csgraph

Signature de la fonction csgraph_to_masked

def csgraph_to_masked(csgraph) 

Description

help(scipy.sparse.csgraph.csgraph_to_masked)

    csgraph_to_masked(csgraph)

    Convert a sparse graph representation to a masked array representation

    .. versionadded:: 0.11.0

    Parameters
    ----------
    csgraph : csr_array, csc_array, or lil_array
        Sparse representation of a graph.

    Returns
    -------
    graph : MaskedArray
        The masked dense representation of the sparse graph.

    Examples
    --------
    >>> from scipy.sparse import csr_array
    >>> from scipy.sparse.csgraph import csgraph_to_masked

    >>> graph = csr_array( [
    ... [0, 1, 2, 0],
    ... [0, 0, 0, 1],
    ... [0, 0, 0, 3],
    ... [0, 0, 0, 0]
    ... ])
    >>> graph
    <Compressed Sparse Row sparse array of dtype 'int64'
        with 4 stored elements and shape (4, 4)>

    >>> csgraph_to_masked(graph)
    masked_array(
      data=[[ --, 1.0, 2.0,  --],
            [ --,  --,  --, 1.0],
            [ --,  --,  --, 3.0],
            [ --,  --,  --,  --]],
      mask=[[ True, False, False,  True],
            [ True,  True,  True, False],
            [ True,  True,  True, False],
            [ True,  True,  True,  True]],
      fill_value=1e+20)

    


Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé