polars.Expr.eq_missing#
- Expr.eq_missing(other: Any) Self [source]#
Method equivalent of equality operator
expr == other
where None == None`.This differs from default
eq
where null values are propagated.- Parameters:
- other
A literal or expression value to compare with.
Examples
>>> df = pl.DataFrame( ... data={ ... "x": [1.0, 2.0, float("nan"), 4.0, None, None], ... "y": [2.0, 2.0, float("nan"), 4.0, 5.0, None], ... } ... ) >>> df.with_columns( ... pl.col("x").eq_missing(pl.col("y")).alias("x == y"), ... ) shape: (6, 3) ┌──────┬──────┬────────┐ │ x ┆ y ┆ x == y │ │ --- ┆ --- ┆ --- │ │ f64 ┆ f64 ┆ bool │ ╞══════╪══════╪════════╡ │ 1.0 ┆ 2.0 ┆ false │ │ 2.0 ┆ 2.0 ┆ true │ │ NaN ┆ NaN ┆ false │ │ 4.0 ┆ 4.0 ┆ true │ │ null ┆ 5.0 ┆ false │ │ null ┆ null ┆ true │ └──────┴──────┴────────┘