pyspark.sql.DataFrame.limit

DataFrame.limit(num)[source]

Limits the result count to the number specified.

New in version 1.3.0.

Examples

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