Skip to main content
`Ctrl`+`K`
scipy.sparse.dok_matrix.

# setdefault

dok_matrix.setdefault(key, default=None, /)

  Insert key with a value of default if key is not in the dictionary.

  Parameters:
    key int or tuple of int

      The key to look for in the dok_array.

    default optional

      The value to insert if key is not found. Default is None.

  Returns:
    scalar

      The value for key if key is in the dictionary, else default.