SciPy

scipy.sparse.lil_matrix.set_shape

lil_matrix.set_shape(shape)[source]

See reshape.