class_docstr: base matrix class for compressed row and column oriented matrices
class_docstr_tok: ["base","matrix","class","for","compressed","row","and","column","oriented","matrices"]
code: def __setitem__(self, index, x):
      # Process arrays from IndexMixin
      i, j = self._unpack_index(index)
      i, j = self._index_to_arrays(i, j)
  
      if isspmatrix(x):
          broadcast_row = x.shape[0] == 1 and i.shape[0] != 1
          broadcast_col = x.shape[1] == 1 and i.shape[1] != 1
          if not (
              (broadcast_row or x.shape[0] == i.shape[0])
              and (broadcast_col or x.shape[1] == i.shape[1])
          ):
              raise ValueError("shape mismatch in assignment")
  
          # clear entries that will be overwritten
          ci, cj = self._swap((i.ravel(), j.ravel()))
          self._zero_many(ci, cj)
  
          x = x.tocoo(copy=True)
          x.sum_duplicates()
          r, c = x.row, x.col
          x = np.asarray(x.data, dtype=self.dtype)
          if broadcast_row:
              r = np.repeat(np.arange(i.shape[0]), len(r))
              c = np.tile(c, i.shape[0])
              x = np.tile(x, i.shape[0])
          if broadcast_col:
              r = np.repeat(r, i.shape[1])
              c = np.tile(np.arange(i.shape[1]), len(c))
              x = np.repeat(x, i.shape[1])
          # only assign entries in the new sparsity structure
          i = i[r, c]
          j = j[r, c]
      else:
          # Make x and i into the same shape
          x = np.asarray(x, dtype=self.dtype)
          x, _ = np.broadcast_arrays(x, i)
  
          if x.shape != i.shape:
              raise ValueError("shape mismatch in assignment")
  
      if np.size(x) == 0:
          return
      i, j = self._swap((i.ravel(), j.ravel()))
      self._set_many(i, j, x.ravel())
  
imports: from __future__ import division, print_function, absolute_import
  from warnings import warn
  import operator
  import numpy
  from scipy._lib.six import zip
  from scipy._lib._util import _prune_array
  from .base import spmatrix, isspmatrix, SparseEfficiencyWarning
  from .data import _data_matrix, _minmax_mixin
  from .dia import dia_matrix
  from .None import _sparsetools
  from .sputils import upcast, upcast_char, to_native, isdense, isshape, getdtype, isscalarlike, IndexMixin, get_index_dtype, downcast_intp_index, get_sum_dtype, check_shape, matrix, asmatrix
label_desc: Use image node_id 26 for calling the _cs_matrix obj's underlying member method code with example usage: obj.__setitem__(index, x) without return types