pyspark.sql.functions.lead

pyspark.sql.functions.lead(col, offset=1, default=None)[source]

Window function: returns the value that is offset rows after the current row, and defaultValue if there is less than offset rows after the current row. For example, an offset of one will return the next row at any given point in the window partition.

This is equivalent to the LEAD function in SQL.

Parameters
  • col – name of column or expression

  • offset – number of row to extend

  • default – default value

New in version 1.4.