pyflink.dataframe.dataframe.DataFrame.limit#
- DataFrame.limit(n: int) DataFrame[source]#
Limit the DataFrame to the first n rows.
This is a lazy transformation that returns a new DataFrame.
- Parameters:
n – The maximum number of rows to return. Must be non-negative.
- Returns:
A new DataFrame limited to at most n rows.
Example:
>>> df = pf.from_records([(1,), (2,), (3,)], schema=["a"]) >>> df.limit(2).collect() [Row(a=1), Row(a=2)]