Skip to content

Window

rank

rank() -> Int

Returns the rank of rows within a window partition, with gaps for ties.

Wrapper for pyspark.sql.functions.rank.

dense_rank

dense_rank() -> Int

Returns the rank of rows within a window partition, without gaps for ties.

Wrapper for pyspark.sql.functions.dense_rank.

row_number

row_number() -> Int

Returns a sequential row number starting from 1 within a window partition.

Wrapper for pyspark.sql.functions.row_number.

lag

lag(
    col: C, offset: int = 1, default: C | None = None
) -> C

Returns the value from a row at a given offset prior to the current row within a window.

Wrapper for pyspark.sql.functions.lag.

lead

lead(
    col: C, offset: int = 1, default: C | None = None
) -> C

Returns the value from a row at a given offset after the current row within a window.

Wrapper for pyspark.sql.functions.lead.

ntile

ntile(n: int) -> Int

Returns the bucket number (1 to n) of each row within an ordered window partition.

Wrapper for pyspark.sql.functions.ntile.

percent_rank

percent_rank() -> Double

Returns the relative rank of rows within a window partition, from 0 to 1.

Wrapper for pyspark.sql.functions.percent_rank.

cume_dist

cume_dist() -> Double

Returns the cumulative distribution of rows within a window partition.

Wrapper for pyspark.sql.functions.cume_dist.

nth_value

nth_value(
    col: C, offset: int, ignoreNulls: bool = False
) -> C

Returns the value of col at the offset-th row of the window frame (1-based).

Wrapper for pyspark.sql.functions.nth_value.