Previous topic

scipy.sparse.save_npz

Next topic

scipy.sparse.find

scipy.sparse.load_npz

scipy.sparse.load_npz(file)[source]

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

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.

Returns:

result : csc_matrix, csr_matrix, bsr_matrix, dia_matrix or coo_matrix

A sparse matrix containing the loaded data.

Raises:

IOError

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

See also

scipy.sparse.save_npz
Save a sparse matrix to a file using .npz format.
numpy.load
Load several arrays from a .npz archive.