Get the first n rows.
Description
A shortcut for $slice(0, n). Consider using the
$fetch() method if you want to test your query. The
$fetch() operation will load the first n rows
at the scan level, whereas
$head() is applied at the end.
Usage
<LazyFrame>$head(n = 5L)
Arguments
n
|
Number of rows to return. |
Details
$limit() is an alias for
$head().
Value
A new LazyFrame object with applied filter.
Examples
#> shape: (5, 2)
#> ┌─────┬─────┐
#> │ a ┆ b │
#> │ --- ┆ --- │
#> │ i32 ┆ i32 │
#> ╞═════╪═════╡
#> │ 1 ┆ 7 │
#> │ 2 ┆ 8 │
#> │ 3 ┆ 9 │
#> │ 4 ┆ 10 │
#> │ 5 ┆ 11 │
#> └─────┴─────┘
#> shape: (2, 2)
#> ┌─────┬─────┐
#> │ a ┆ b │
#> │ --- ┆ --- │
#> │ i32 ┆ i32 │
#> ╞═════╪═════╡
#> │ 1 ┆ 7 │
#> │ 2 ┆ 8 │
#> └─────┴─────┘