polars.internals.expr.ExprListNameSpace.first¶
- ExprListNameSpace.first() polars.internals.expr.Expr ¶
Get the first value of the sublists.
Examples
>>> df = pl.DataFrame({"foo": [[3, 2, 1], [], [1, 2]]}) >>> df.select(pl.col("foo").arr.first()) shape: (3, 1) ┌──────┐ │ foo │ │ --- │ │ i64 │ ╞══════╡ │ 3 │ ├╌╌╌╌╌╌┤ │ null │ ├╌╌╌╌╌╌┤ │ 1 │ └──────┘