sparc
sparc

Reputation: 429

Get maximum value of each id in Pyspark

I have data like this

enter image description here

and I need output like this

enter image description here

Upvotes: 1

Views: 98

Answers (1)

wwnde
wwnde

Reputation: 26676

Groupby everything and find max value. Code below

  from pyspark.sql import Window

df.withColumn('Value',max('Amount').over(Window.partitionBy())).show()

Upvotes: 1

Related Questions