SciPy

scipy.sparse.csc_matrix.asformat

csc_matrix.asformat(format, copy=False)[source]

Return this matrix in the passed sparse format.

Parameters:

format : {str, None}

The desired sparse matrix format (“csr”, “csc”, “lil”, “dok”, ...) or None for no conversion.

copy : bool, optional

If True, the result is guaranteed to not share data with self.

Returns:

A : This matrix in the passed sparse format.