Skip to content

Inspect evaluated Series

Source code

Description

Print the value that this expression evaluates to and pass on the value. The printing will happen when the expression evaluates, not when it is formed.

Usage

<Expr>$inspect(fmt = "{}")

Arguments

fmt format string, should contain one set of {} where object will be printed. This formatting mimics python "string".format() use in py-polars.

Value

Expr

Examples

library(polars)

pl$select(pl$lit(1:5)$inspect(
  "Here's what the Series looked like before keeping the first two values: {}"
)$head(2))
#> Here's what the Series looked like before keeping the first two values: shape: (5,)
#> Series: '' [i32]
#> [
#>  1
#>  2
#>  3
#>  4
#>  5
#> ]

#> shape: (2, 1)
#> ┌─────┐
#> │     │
#> │ --- │
#> │ i32 │
#> ╞═════╡
#> │ 1   │
#> │ 2   │
#> └─────┘