Get the first n
rows of each group
Description
Get the first n
rows of each group
Usage
<GroupBy>$head(n = 5)
Arguments
n
|
Number of rows to return. |
Value
A polars DataFrame
Examples
#> shape: (6, 2)
#> ┌─────────┬─────┐
#> │ letters ┆ nrs │
#> │ --- ┆ --- │
#> │ str ┆ i32 │
#> ╞═════════╪═════╡
#> │ c ┆ 1 │
#> │ c ┆ 2 │
#> │ a ┆ 3 │
#> │ c ┆ 4 │
#> │ a ┆ 5 │
#> │ b ┆ 6 │
#> └─────────┴─────┘
#> shape: (5, 2)
#> ┌─────────┬─────┐
#> │ letters ┆ nrs │
#> │ --- ┆ --- │
#> │ str ┆ i32 │
#> ╞═════════╪═════╡
#> │ a ┆ 3 │
#> │ a ┆ 5 │
#> │ b ┆ 6 │
#> │ c ┆ 1 │
#> │ c ┆ 2 │
#> └─────────┴─────┘