Skip to main content
Version: 1.8.0

Expr.str.zfill

def zfill(length: int | td_IntoExprColumn) -> Expr

Categories: string

Pad numeric string values at the start to the given length using zeros.

Parameters

parameter
length

The 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 │
------
strstr
╞══════╪═══════╡
000
101
10001000
│ null ┆ null │
└──────┴───────┘