Skip to content

Hash elements

Description

Hash elements

Usage

<Expr>$hash(seed = 0, seed_1 = NULL, seed_2 = NULL, seed_3 = NULL)

Arguments

seed Integer, random seed parameter. Defaults to 0.
seed_1, seed_2, seed_3 Integer, random seed parameters. Default to seed if not set.

Details

This implementation of hash does not guarantee stable results across different Polars versions. Its stability is only guaranteed within a single version.

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = c(1, 2, NA), b = c("x", NA, "z"))
df$with_columns(pl$all()$hash(10, 20, 30, 40))
#> shape: (3, 2)
#> ┌─────────────────────┬──────────────────────┐
#> │ a                   ┆ b                    │
#> │ ---                 ┆ ---                  │
#> │ u64                 ┆ u64                  │
#> ╞═════════════════════╪══════════════════════╡
#> │ 4906667782631156245 ┆ 1872343255370750739  │
#> │ 4126687270318313546 ┆ 9420403246054175489  │
#> │ 9420403246054175489 ┆ 13144241821699062451 │
#> └─────────────────────┴──────────────────────┘