Reinterpret the underlying bits as a signed/unsigned integer
Description
This operation is only allowed for 64-bit integers. For lower bits integers, you can safely use the $cast() operation.
Usage
<Expr>$reinterpret(..., signed = TRUE)
Arguments
…
|
These dots are for future extensions and must be empty. |
signed
|
If TRUE (default), reinterpret as pl$Int64. Otherwise,
reinterpret as pl$UInt64.
|
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(a = c(1, 1, 2))$cast(pl$UInt64)
# Create a Series with 3 nulls, append column a then rechunk
df$with_columns(
reinterpreted = pl$col("a")$reinterpret()
)
#> shape: (3, 2)
#> ┌─────┬───────────────┐
#> │ a ┆ reinterpreted │
#> │ --- ┆ --- │
#> │ u64 ┆ i64 │
#> ╞═════╪═══════════════╡
#> │ 1 ┆ 1 │
#> │ 1 ┆ 1 │
#> │ 2 ┆ 2 │
#> └─────┴───────────────┘