pyspark.sql.functions.equal_null¶
-
pyspark.sql.functions.
equal_null
(col1: ColumnOrName, col2: ColumnOrName) → pyspark.sql.column.Column[source]¶ Returns same result as the EQUAL(=) operator for non-null operands, but returns true if both are null, false if one of the them is null.
New in version 3.5.0.
Examples
>>> df = spark.createDataFrame([(None, None,), (1, 9,)], ["a", "b"]) >>> df.select(equal_null(df.a, df.b).alias('r')).collect() [Row(r=True), Row(r=False)]