scipy.sparse.csr_array.reshape#
- csr_array.reshape(self, shape, order='C', copy=False)[source]#
Gives a new shape to a sparse array/matrix without changing its data.
- Parameters:
- shapelength-2 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.
- copybool, 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:
- reshapedsparse 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