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 zero if col is null, or col otherwise.
For the corresponding Databricks SQL function, see zeroifnull function.
Syntax
from pyspark.sql import functions as dbf
dbf.zeroifnull(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
The column to check. |
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(None,), (1,)], ["a"])
df.select('*', dbf.zeroifnull(df.a)).show()
+----+-------------+
| a|zeroifnull(a)|
+----+-------------+
|NULL| 0|
| 1| 1|
+----+-------------+