Skip to main content
`Ctrl`+`K`

# scipy.sparse.issparse

scipy.sparse.issparse(x)

  Is x of a sparse array or sparse matrix type?

  Parameters:
    x

      object to check for being a sparse array or sparse matrix

  Returns:
    bool

      True if x is a sparse array or a sparse matrix, False otherwise

  Examples

      >>> import numpy as np
      >>> from scipy.sparse import csr_array, csr_matrix, issparse
      >>> issparse(csr_matrix([[5]]))
      True
      >>> issparse(csr_array([[5]]))
      True
      >>> issparse(np.array([[5]]))
      False
      >>> issparse(5)
      False