str.len¶
- ColExpr.str.len() ColExpr[Int][source]¶
Computes the length of the string.
Leading and trailing whitespace is included in the length.
Examples
>>> t = pdt.Table( ... { ... "a": [" BCD ", "-- 00", " A^^u", "-O2"], ... "b": ["12431", "transform", "12__*m", " "], ... }, ... name="string table", ... ) >>> t >> mutate(j=t.a.str.len(), k=t.b.str.len()) >> show() Table string table, backend: PolarsImpl shape: (4, 4) ┌────────┬───────────┬─────┬─────┐ │ a ┆ b ┆ j ┆ k │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ str ┆ i64 ┆ i64 │ ╞════════╪═══════════╪═════╪═════╡ │ BCD ┆ 12431 ┆ 6 ┆ 5 │ │ -- 00 ┆ transform ┆ 5 ┆ 9 │ │ A^^u ┆ 12__*m ┆ 5 ┆ 6 │ │ -O2 ┆ ┆ 3 ┆ 3 │ └────────┴───────────┴─────┴─────┘