pyspark.sql.DataFrame.offset#
- DataFrame.offset(num)[source]#
Returns a new :class: DataFrame by skipping the first n rows.
New in version 3.4.0.
Changed in version 3.5.0: Supports vanilla PySpark.
- Parameters
- numint
Number of records to skip.
- Returns
DataFrame
Subset of the records
Examples
>>> df = spark.createDataFrame( ... [(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"]) >>> df.offset(1).show() +---+-----+ |age| name| +---+-----+ | 23|Alice| | 16| Bob| +---+-----+ >>> df.offset(10).show() +---+----+ |age|name| +---+----+ +---+----+