I have issues in solving the following problem.
Basically I want to find on which date a particular item(item_code) was sold maximum and minimum volume.
Input DataFrame
item_code, sold_date, price, volume
101, 10-12-2017, 20, 500
101, 11-12-2017, 20, 400
201, 10-12-2017, 50, 200
201, 13-12-2017, 51, 300
Expected output
Find max and min volume with sold date.I want this solution without using any lambda operations.
df.groupBy("item_code")agg(min("volume"),max("volume"))
the above one will help me to get max and min of volume but I want them along with respective date.
I tried my level best with udf but I could not crack it. any help highly appreciated.
