pyspark.sql.functions.isnotnull

pyspark.sql.functions. isnotnull ( col : ColumnOrName ) → pyspark.sql.column.Column [source]

如果 col 不为null,则返回true,否则返回false.

在版本 3.5.0 中新增。

Parameters
col or str

示例

>>> df = spark.createDataFrame([(None,), (1,)], ["e"])
>>> df.select(isnotnull(df.e).alias('r')).collect()
[Row(r=False), Row(r=True)]