pyspark.sql.DataFrame.limit

DataFrame.limit(num: int) → pyspark.sql.dataframe.DataFrame

Limits the result count to the number specified.

Examples

>>> df.limit(1).collect()
[Row(age=2, name='Alice')]
>>> df.limit(0).collect()
[]