Skip to main content
Version: 1.9.1

Expr.shrink_dtype

method
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 │
╞═══════╪══════════════╡
00
256256
6502565025
└───────┴──────────────┘