Shrink numeric columns to the minimal required datatype
Description
Shrink to the dtype needed to fit the extrema of this Series. This can be used to reduce memory pressure.
Usage
<Expr>$shrink_dtype()
Value
Expr
Examples
#> shape: (3, 2)
#> ┌─────┬─────┐
#> │ a ┆ b │
#> │ --- ┆ --- │
#> │ i32 ┆ f64 │
#> ╞═════╪═════╡
#> │ 1 ┆ 1.0 │
#> │ 2 ┆ 2.0 │
#> │ 3 ┆ 3.0 │
#> └─────┴─────┘
#> shape: (3, 4)
#> ┌─────┬─────┬──────────┬──────────┐
#> │ a ┆ b ┆ a_shrunk ┆ b_shrunk │
#> │ --- ┆ --- ┆ --- ┆ --- │
#> │ i32 ┆ f64 ┆ i8 ┆ f32 │
#> ╞═════╪═════╪══════════╪══════════╡
#> │ 1 ┆ 1.0 ┆ 1 ┆ 1.0 │
#> │ 2 ┆ 2.0 ┆ 2 ┆ 2.0 │
#> │ 3 ┆ 3.0 ┆ 3 ┆ 3.0 │
#> └─────┴─────┴──────────┴──────────┘