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

# reshape

lil_array.reshape(self, shape, order='C', copy=False)

  Gives a new shape to a sparse array/matrix without changing its data.

  Parameters:
    shape tuple of ints

      The new shape should be compatible with the original shape.

    order{‘C’, ‘F’}, optional

      Read the elements using this index order. ‘C’ means to read and write the elements using C-like index order; e.g., read entire first row, then second row, etc. ‘F’ means to read and write the elements using Fortran-like index order; e.g., read entire first column, then second column, etc.

    copy bool, optional

      Indicates whether or not attributes of self should be copied whenever possible. The degree to which attributes are copied varies depending on the type of sparse array being used.

  Returns:
    reshaped sparse array/matrix

      A sparse array/matrix with the given `shape`, not necessarily of the same format as the current object.

  See also

  `numpy.reshape`

    NumPy’s implementation of ‘reshape’ for ndarrays