Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pyspark.sql.Window#

classpyspark.sql.Window[source]#

Utility functions for defining window in DataFrames.

New in version 1.4.0.

Changed in version 3.4.0:Supports Spark Connect.

Notes

When ordering is not defined, an unbounded window frame (rowFrame,unboundedPreceding, unboundedFollowing) is used by default. When ordering is defined,a growing window frame (rangeFrame, unboundedPreceding, currentRow) is used by default.

Examples

>>># ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW>>>window=Window.orderBy("date").rowsBetween(Window.unboundedPreceding,Window.currentRow)
>>># PARTITION BY country ORDER BY date RANGE BETWEEN 3 PRECEDING AND 3 FOLLOWING>>>window=Window.orderBy("date").partitionBy("country").rangeBetween(-3,3)

Methods

orderBy(*cols)

Creates aWindowSpec with the ordering defined.

partitionBy(*cols)

Creates aWindowSpec with the partitioning defined.

rangeBetween(start, end)

Creates aWindowSpec with the frame boundaries defined, fromstart (inclusive) toend (inclusive).

rowsBetween(start, end)

Creates aWindowSpec with the frame boundaries defined, fromstart (inclusive) toend (inclusive).

Attributes

currentRow

unboundedFollowing

unboundedPreceding


[8]ページ先頭

©2009-2025 Movatter.jp