Nota
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tidħol jew tibdel id-direttorji.
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tibdel id-direttorji.
Returns null if col1 equals to col2, or col1 otherwise.
For the corresponding Databricks SQL function, see nullif function.
Syntax
from pyspark.sql import functions as dbf
dbf.nullif(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
The first column to check. |
col2 |
pyspark.sql.Column or str |
The column to compare with col1. |
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(None, None,), (1, 9,)], ["a", "b"])
df.select('*', dbf.nullif(df.a, df.b)).show()
+----+----+------------+
| a| b|nullif(a, b)|
+----+----+------------+
|NULL|NULL| NULL|
| 1| 9| 1|
+----+----+------------+