pyspark.sql.DataFrame.limit

DataFrame.limit(num)[source]

Limits the result count to the number specified.

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

New in version 1.3.