Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Returns null if col is equal to zero, or col otherwise.
For the corresponding Databricks SQL function, see nullifzero function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.nullifzero(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
The column to check. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(0,), (1,)], ["a"])
df.select('*', dbf.nullifzero(df.a)).show()
+---+-------------+
| a|nullifzero(a)|
+---+-------------+
| 0| NULL|
| 1| 1|
+---+-------------+