Skip to content

Interpolate intermediate values

Description

The interpolation method is linear.

Usage

<LazyFrame>$interpolate()

Value

A polars LazyFrame

Examples

library("polars")

lf <- pl$LazyFrame(
  foo = c(1, NA, 9, 10),
  bar = c(6, 7, 9, NA),
  ham = c(1, NA, NA, 9)
)

lf$interpolate()$collect()
#> shape: (4, 3)
#> ┌──────┬──────┬──────────┐
#> │ foo  ┆ bar  ┆ ham      │
#> │ ---  ┆ ---  ┆ ---      │
#> │ f64  ┆ f64  ┆ f64      │
#> ╞══════╪══════╪══════════╡
#> │ 1.0  ┆ 6.0  ┆ 1.0      │
#> │ 5.0  ┆ 7.0  ┆ 3.666667 │
#> │ 9.0  ┆ 9.0  ┆ 6.333333 │
#> │ 10.0 ┆ null ┆ 9.0      │
#> └──────┴──────┴──────────┘