Expr.shrink_dtype
def shrink_dtype() -> Expr
Categories: numeric
Cast down a column to the smallest type that can hold the element values.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("val"), td.col("val").shrink_dtype()
>>> .alias("shrink_dtype"))
>>>
┌───────┬──────────────┐
│ val ┆ shrink_dtype │
│ --- ┆ --- │
│ i64 ┆ i32 │
╞═══════╪══════════════╡
│ 0 ┆ 0 │
│ 256 ┆ 256 │
│ 65025 ┆ 65025 │
└───────┴──────────────┘