Check equality
Description
This propagates null values, i.e. any comparison involving
null
will return null
. Use
$eq_missing()
to consider null values as equal.
Usage
<Expr>$eq(other)
Arguments
other
|
A literal or expression value to compare with. |
Value
A polars expression
See Also
expr__eq_missing
Examples
library("polars")
df <- pl$DataFrame(x = c(NA, FALSE, TRUE), y = c(TRUE, TRUE, TRUE))
df$with_columns(
eq = pl$col("x")$eq(pl$col("y")),
eq_missing = pl$col("x")$eq_missing(pl$col("y"))
)
#> shape: (3, 4)
#> ┌───────┬──────┬───────┬────────────┐
#> │ x ┆ y ┆ eq ┆ eq_missing │
#> │ --- ┆ --- ┆ --- ┆ --- │
#> │ bool ┆ bool ┆ bool ┆ bool │
#> ╞═══════╪══════╪═══════╪════════════╡
#> │ null ┆ true ┆ null ┆ false │
#> │ false ┆ true ┆ false ┆ false │
#> │ true ┆ true ┆ true ┆ true │
#> └───────┴──────┴───────┴────────────┘