Extend the Series with n
copies of a value
Description
Extend the Series with n
copies of a value
Usage
<Expr>$extend_constant(value, n)
Arguments
value
|
A constant literal value or a unit expression with which to extend the
expression result Series. This can be NA to extend with
nulls.
|
n
|
The number of additional values that will be added. |
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(values = 1:3)
df$select(pl$col("values")$extend_constant(99, n = 2))
#> shape: (5, 1)
#> ┌────────┐
#> │ values │
#> │ --- │
#> │ i32 │
#> ╞════════╡
#> │ 1 │
#> │ 2 │
#> │ 3 │
#> │ 99 │
#> │ 99 │
#> └────────┘