SciPy

scipy.sparse.dia_matrix.astype

dia_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.