Skip to content

Create a single chunk of memory for this Series

Description

Create a single chunk of memory for this Series

Usage

<Expr>$rechunk()

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = c(1, 1, 2))

# Create a Series with 3 nulls, append column a then rechunk
df$select(pl$repeat_(NA, 3)$append(pl$col("a"))$rechunk())
#> shape: (6, 1)
#> ┌────────┐
#> │ repeat │
#> │ ---    │
#> │ f64    │
#> ╞════════╡
#> │ null   │
#> │ null   │
#> │ null   │
#> │ 1.0    │
#> │ 1.0    │
#> │ 2.0    │
#> └────────┘