Skip to content

Hash elements

Source code

Description

Hash elements

Usage

<Expr>$hash(seed = 0)

Arguments

seed Integer, random seed parameter. Defaults to 0.

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(seed = 10))
#> shape: (3, 2)
#> ┌─────────────────────┬──────────────────────┐
#> │ a                   ┆ b                    │
#> │ ---                 ┆ ---                  │
#> │ u64                 ┆ u64                  │
#> ╞═════════════════════╪══════════════════════╡
#> │ 5392523578929506835 ┆ 16781991129816432610 │
#> │ 2878895092495713785 ┆ 7258764664910671222  │
#> │ 7258764664910671222 ┆ 13009084120129425575 │
#> └─────────────────────┴──────────────────────┘