PySpark Group and apply UDF row by row operation
you need an aggregation ? 
df.groupBy("tag").agg({"date":"min"})
what about that ?
I have a dataset that contains 'tag' and 'date'. I need to group the data by 'tag' (this is pretty easy), then within each group count the number of row that the date for them is smaller than the date in that specific row. I basically need to loop over the rows after grouping the data. I don't know how to write a UDF which takes care of that in PySpark. I appreciate your help.