polars.Expr.extend_constant
-
Extremely fast method for extending the Series with ‘n’ copies of a value.
- Parameters:
-
- value
-
A constant literal value or a unit expression with which to extend the expression result Series; can pass None to extend with nulls.
- n
-
The number of additional values that will be added.
Examples
>>> df = pl.DataFrame({"values": [1, 2, 3]}) >>> df.select((pl.col("values") - 1).extend_constant(99, n=2)) shape: (5, 1) ┌────────┐ │ values │ │ --- │ │ i64 │ ╞════════╡ │ 0 │ │ 1 │ │ 2 │ │ 99 │ │ 99 │ └────────┘
Expr.extend_constant(
value: IntoExpr,
n: int | IntoExprColumn,
) → Expr
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.extend_constant.html