Skip to content

Reinterpret bits

Source code

Description

Reinterpret the underlying bits as a signed/unsigned integer. This operation is only allowed for Int64. For lower bits integers, you can safely use the cast operation.

Usage

<Expr>$reinterpret(signed = TRUE)

Arguments

signed If TRUE (default), reinterpret into Int64. Otherwise, it will be reinterpreted in UInt64.

Value

Expr

Examples

library("polars")

df = pl$DataFrame(x = 1:5, schema = list(x = pl$Int64))
df$select(pl$all()$reinterpret())
#> shape: (5, 1)
#> ┌─────┐
#> │ x   │
#> │ --- │
#> │ i64 │
#> ╞═════╡
#> │ 1   │
#> │ 2   │
#> │ 3   │
#> │ 4   │
#> │ 5   │
#> └─────┘