daft.DataFrame.limit#
- DataFrame.limit(num: int) DataFrame [source]#
Limits the rows in the DataFrame to the first
N
rows, similar to a SQLLIMIT
Example
>>> import daft >>> df = df = daft.from_pydict({"x": [1, 2, 3, 4, 5, 6, 7]}) >>> df_limited = df.limit(5) # returns 5 rows >>> df_limited.show() ╭───────╮ │ x │ │ --- │ │ Int64 │ ╞═══════╡ │ 1 │ ├╌╌╌╌╌╌╌┤ │ 2 │ ├╌╌╌╌╌╌╌┤ │ 3 │ ├╌╌╌╌╌╌╌┤ │ 4 │ ├╌╌╌╌╌╌╌┤ │ 5 │ ╰───────╯ (Showing first 5 of 5 rows)
- Parameters:
num (int) – maximum rows to allow.
eager (bool) – whether to maximize for latency (time to first result) by eagerly executing only one partition at a time, or throughput by executing multiple limits at a time
- Returns:
Limited DataFrame
- Return type: