SciPy

scipy.sparse.dok_matrix.astype

dok_matrix.astype(t)[source]

Cast the matrix elements to a specified type.

The data will be copied.

Parameters:

t : string or numpy dtype

Typecode or data-type to which to cast the data.