Loading [MathJax]/jax/input/TeX/config.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

ParametersRaisesReturnsBackRef
load_npz(file)

Parameters

file : str or file-like object

Either the file name (string) or an open file (file-like object) where the data will be loaded.

Raises

OSError

If the input file does not exist or cannot be read.

Returns

result : csc_matrix, csr_matrix, bsr_matrix, dia_matrix or coo_matrix

A sparse matrix containing the loaded data.

Load a sparse matrix from a file using .npz format.

See Also

numpy.load

Load several arrays from a
.npz
archive.

scipy.sparse.save_npz

Save a sparse matrix to a file using
.npz
format.

Examples

Store sparse matrix to disk, and load it again:
import numpy as np
import scipy.sparse
sparse_matrix = scipy.sparse.csc_matrix(np.array([[0, 0, 3], [4, 0, 0]]))
sparse_matrix
sparse_matrix.toarray()
scipy.sparse.save_npz('/tmp/sparse_matrix.npz', sparse_matrix)
sparse_matrix = scipy.sparse.load_npz('/tmp/sparse_matrix.npz')
sparse_matrix
sparse_matrix.toarray()
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.sparse._matrix_io:save_npz

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

numpy.loadloadscipy.sparse._matrix_io:save_npz_matrix_io:save_npz

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/sparse/_matrix_io.py#76
type: <class 'function'>
Commit: