pyspark.sql.functions.
row_number
Window function: returns a sequential number starting at 1 within a window partition.
New in version 1.6.