how to get max value in pyspark dataframe

Solutions on MaxInterview for how to get max value in pyspark dataframe by the best coders in the world

showing results for - "how to get max value in pyspark dataframe"
Eden
24 Mar 2020
1# here data is a pyspark.sql dataframe and balance is it's column
2
3# get the mean value of a column
4data.agg({'balance': 'mean'}).show()
5#or
6# get the max value of a column
7data.agg({'balance': 'avg'}).show()
8
9------other related function ------
10few possible parameters are
11['max', 'min', 'stddev', 'variance', 'count', 'skewness', 'kurtosis', 'sum']
12
13# get the max value of a column
14data.agg({'balance': 'max'}).show()
15
16# get the min value of a column
17data.agg({'balance': 'min'}).show()
18
19# get the standard deviation of a column
20data.agg({'balance': 'stddev'}).show()
21
22# get the variance of a column
23data.agg({'balance': 'variance'}).show()