polars.internals.expr.ExprListNameSpace.lengths

ExprListNameSpace.lengths() polars.internals.expr.Expr

Get the length of the arrays as UInt32.

Examples

>>> df = pl.DataFrame({"foo": [1, 2], "bar": [["a", "b"], ["c"]]})
>>> df.select(pl.col("bar").arr.lengths())
shape: (2, 1)
┌─────┐
│ bar │
│ --- │
│ u32 │
╞═════╡
│ 2   │
├╌╌╌╌╌┤
│ 1   │
└─────┘