polars.DataFrame.shrink_to_fit#

DataFrame.shrink_to_fit(*, in_place: bool = False) Self[source]#

Shrink DataFrame memory usage.

Shrinks to fit the exact capacity needed to hold the data.