polars.Series.shrink_to_fit#

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

Shrink Series memory usage.

Shrinks the underlying array capacity to exactly fit the actual data. (Note that this function does not change the Series data type).