Skip to content

Check inequality

Description

This propagates null values, i.e. any comparison involving null will return null. Use $ne_missing() to consider null values as equal.

Usage

<Expr>$ne(other)

Arguments

other A literal or expression value to compare with.

Value

A polars expression

See Also

expr__ne_missing

Examples

library("polars")

df <- pl$DataFrame(x = c(NA, FALSE, TRUE), y = c(TRUE, TRUE, TRUE))
df$with_columns(
  ne = pl$col("x")$ne(pl$col("y")),
  ne_missing = pl$col("x")$ne_missing(pl$col("y"))
)
#> shape: (3, 4)
#> ┌───────┬──────┬───────┬────────────┐
#> │ x     ┆ y    ┆ ne    ┆ ne_missing │
#> │ ---   ┆ ---  ┆ ---   ┆ ---        │
#> │ bool  ┆ bool ┆ bool  ┆ bool       │
#> ╞═══════╪══════╪═══════╪════════════╡
#> │ null  ┆ true ┆ null  ┆ true       │
#> │ false ┆ true ┆ true  ┆ true       │
#> │ true  ┆ true ┆ false ┆ false      │
#> └───────┴──────┴───────┴────────────┘