diff --git a/docs/src/python/user-guide/expressions/aggregation.py b/docs/src/python/user-guide/expressions/aggregation.py index 79120d79547f..a8643bd5d31e 100644 --- a/docs/src/python/user-guide/expressions/aggregation.py +++ b/docs/src/python/user-guide/expressions/aggregation.py @@ -158,7 +158,9 @@ def get_person() -> pl.Expr: get_person().first().alias("youngest"), get_person().last().alias("oldest"), get_person().sort().first().alias("alphabetical_first"), - pl.col("gender").sort_by("first_name").first().alias("gender"), + pl.col("gender") + .sort_by(pl.col("first_name").cat.set_ordering("lexical")) + .first(), ) .sort("state") .limit(5)