pyspark.sql.functions.isnan

pyspark.sql.functions.isnan(col: ColumnOrName) → pyspark.sql.column.Column

An expression that returns true iff the column is NaN.

Examples

>>> df = spark.createDataFrame([(1.0, float('nan')), (float('nan'), 2.0)], ("a", "b"))
>>> df.select(isnan("a").alias("r1"), isnan(df.a).alias("r2")).collect()
[Row(r1=False, r2=False), Row(r1=True, r2=True)]