SciPy

scipy.sparse.isspmatrix_csr

scipy.sparse.isspmatrix_csr(x)[source]

Is x of csr_matrix type?

Parameters:

x

object to check for being a csr matrix

Returns:

bool

True if x is a csr matrix, False otherwise

Examples

>>> from scipy.sparse import csr_matrix, isspmatrix_csr
>>> isspmatrix_csr(csr_matrix([[5]]))
True
>>> from scipy.sparse import csc_matrix, csr_matrix, isspmatrix_csc
>>> isspmatrix_csr(csc_matrix([[5]]))
False