pyspark.sql.DataFrame.agg¶
-
DataFrame.
agg
(*exprs: Union[pyspark.sql.column.Column, Dict[str, str]]) → pyspark.sql.dataframe.DataFrame¶ Aggregate on the entire
DataFrame
without groups (shorthand fordf.groupBy().agg()
).Examples
>>> df.agg({"age": "max"}).collect() [Row(max(age)=5)] >>> from pyspark.sql import functions as F >>> df.agg(F.min(df.age)).collect() [Row(min(age)=2)]