Skip to main content

isnull

An expression that returns true if the column is null. Supports Spark Connect.

For the corresponding Databricks SQL function, see isnull function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.isnull(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

Target column to compute on.

Returns

pyspark.sql.Column: True if value is null and False otherwise.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(1, None), (None, 2)], ("a", "b"))
df.select("*", dbf.isnull("a"), dbf.isnull(df.b)).show()
Output
+----+----+-----------+-----------+
| a| b|(a IS NULL)|(b IS NULL)|
+----+----+-----------+-----------+
| 1|NULL| false| true|
|NULL| 2| true| false|
+----+----+-----------+-----------+