pyspark.sql.DataFrame.na¶
-
property
DataFrame.
na
¶ Returns a
DataFrameNaFunctions
for handling missing values.New in version 1.3.1.
Changed in version 3.4.0: Supports Spark Connect.
- Returns
Examples
>>> df = spark.sql("SELECT 1 AS c1, int(NULL) AS c2") >>> type(df.na) <class '...dataframe.DataFrameNaFunctions'>
Replace the missing values as 2.
>>> df.na.fill(2).show() +---+---+ | c1| c2| +---+---+ | 1| 2| +---+---+