pyspark.sql.functions.
lag
Window function: returns the value that is offset rows before the current row, and default if there is less than offset rows before the current row. For example, an offset of one will return the previous row at any given point in the window partition.
This is equivalent to the LAG function in SQL.
New in version 1.4.0.
Column
name of column or expression
number of row to extend
default value