Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
An expression that returns true if the column is NaN. Supports Spark Connect.
For the corresponding Databricks SQL function, see isnan function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.isnan(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 NaN and False otherwise.
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(1.0, float('nan')), (float('nan'), 2.0)], ("a", "b"))
df.select("*", dbf.isnan("a"), dbf.isnan(df.b)).show()
+---+---+--------+--------+
| a| b|isnan(a)|isnan(b)|
+---+---+--------+--------+
|1.0|NaN| false| true|
|NaN|2.0| true| false|
+---+---+--------+--------+