SciPy

scipy.sparse.dok_matrix.reshape

dok_matrix.reshape(shape)[source]