Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
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.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.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|
+---+---+--------+--------+