How to find maximum value of a column in python dataframe

Viewed 39483

I have a data frame in pyspark. In this data frame I have column called id that is unique.

Now I want to find the maximum value of the column id in the data frame.

I have tried like below

df['id'].max()

But got below error

TypeError: 'Column' object is not callable

Please let me know how to find the maximum value of a column in data frame

In the answer by @Dadep the link gives the correct answer

4 Answers

The following can be used in pyspark:

df.select(max("id")).show()
Related