Best way to get the max value in a Spark dataframe column

后端 未结 13 1104
一整个雨季
一整个雨季 2020-12-07 10:27

I\'m trying to figure out the best way to get the largest value in a Spark dataframe column.

Consider the following example:

df = spark.createDataFra         


        
13条回答
  •  青春惊慌失措
    2020-12-07 10:33

    Max value for a particular column of a dataframe can be achieved by using -

    your_max_value = df.agg({"your-column": "max"}).collect()[0][0]

提交回复
热议问题