pyspark.sql.functions.isnan¶
-
pyspark.sql.functions.
isnan
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ An expression that returns true if the column is NaN.
New in version 1.6.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or str target column to compute on.
- col
- Returns
Column
True if value is NaN and False otherwise.
Examples
>>> df = spark.createDataFrame([(1.0, float('nan')), (float('nan'), 2.0)], ("a", "b")) >>> df.select("a", "b", isnan("a").alias("r1"), isnan(df.b).alias("r2")).show() +---+---+-----+-----+ | a| b| r1| r2| +---+---+-----+-----+ |1.0|NaN|false| true| |NaN|2.0| true|false| +---+---+-----+-----+