pyspark.sql.functions.isnotnull#

pyspark.sql.functions.isnotnull(col)[source]#

Returns true if col is not null, or false otherwise.

New in version 3.5.0.

Parameters
colColumn or column name

Examples

>>> from pyspark.sql import functions as sf
>>> df = spark.createDataFrame([(None,), (1,)], ["e"])
>>> df.select('*', sf.isnotnull(df.e)).show()
+----+---------------+
|   e|(e IS NOT NULL)|
+----+---------------+
|NULL|          false|
|   1|           true|
+----+---------------+
>>> df.select('*', sf.isnotnull('e')).show()
+----+---------------+
|   e|(e IS NOT NULL)|
+----+---------------+
|NULL|          false|
|   1|           true|
+----+---------------+