Expr.str.zfill
methodView source ↗
def zfill(length: int | td_IntoExprColumn) -> Expr
Categories: string
Pad numeric string values at the start to the given length using zeros.
Parameters
parameter
lengthThe length to end pad the string to.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a").str.zfill(2).alias("zfill"))
>>>
┌──────┬───────┐
│ a ┆ zfill │
│ --- ┆ --- │
│ str ┆ str │
╞══════╪═══════╡
│ 0 ┆ 00 │
│ 1 ┆ 01 │
│ 1000 ┆ 1000 │
│ null ┆ null │
└──────┴───────┘