pyspark.sql.DataFrame.take

DataFrame.take(num: int) → List[pyspark.sql.types.Row]

Returns the first num rows as a list of Row.

Examples

>>> df.take(2)
[Row(age=2, name='Alice'), Row(age=5, name='Bob')]