scipy.sparse.isspmatrix#
- scipy.sparse.isspmatrix(x)[source]#
Is x of a sparse matrix type?
- Parameters:
- x
object to check for being a sparse matrix
- Returns:
- bool
True if x is a sparse matrix, False otherwise
Examples
>>> import numpy as np >>> from scipy.sparse import csr_array, csr_matrix, isspmatrix >>> isspmatrix(csr_matrix([[5]])) True >>> isspmatrix(csr_array([[5]])) False >>> isspmatrix(np.array([[5]])) False >>> isspmatrix(5) False