![]() |
VOOZH | about |
In this article, we are going to find the Maximum, Minimum, and Average of particular column in PySpark dataframe.
For this, we will use agg() function. This function Compute aggregates and returns the result as DataFrame.
Syntax: dataframe.agg({'column_name': 'avg/'max/min})
Where,
- dataframe is the input dataframe
- column_name is the column in the dataframe
Creating DataFrame for demonstration:
Output:
👁 ImageExample 1: Python program to find the average of dataframe column
Output:
👁 ImageExample 2: Get average from multiple columns
Output:
👁 ImageExample 1: Python program to find the minimum value in dataframe column.
Output:
👁 ImageExample 2: Get minimum value from multiple columns
Output:
👁 ImageExample 1: Python program to find the maximum value in dataframe column
Output:
👁 ImageExample 2: Get maximum value from multiple columns
Output:
👁 Image