pyspark.sql.DataFrame.stat#

property DataFrame.stat#

Returns a DataFrameStatFunctions for statistic functions.

New in version 1.4.0.

Changed in version 3.4.0: Supports Spark Connect.

Returns
DataFrameStatFunctions

Examples

>>> import pyspark.sql.functions as f
>>> df = spark.range(3).withColumn("c", f.expr("id + 1"))
>>> type(df.stat)
<class '...dataframe.DataFrameStatFunctions'>
>>> df.stat.corr("id", "c")
1.0