Get the first n
rows.
Description
This function is syntactic sugar for pl$col(…)$head(n)
.
Usage
pl$head(..., n = 10)
Arguments
…
|
Characters indicating the column names, passed to pl$col() .
See ?pl_col for details.
|
n
|
Number of rows to return. |
Value
Expr
See Also
-
\
$head()
Examples
library("polars")
df = pl$DataFrame(
a = c(1, 8, 3),
b = c(4, 5, 2),
c = c("foo", "bar", "foo")
)
df$select(pl$head("a"))
#> shape: (3, 1)
#> ┌─────┐
#> │ a │
#> │ --- │
#> │ f64 │
#> ╞═════╡
#> │ 1.0 │
#> │ 8.0 │
#> │ 3.0 │
#> └─────┘
#> shape: (2, 2)
#> ┌─────┬─────┐
#> │ a ┆ b │
#> │ --- ┆ --- │
#> │ f64 ┆ f64 │
#> ╞═════╪═════╡
#> │ 1.0 ┆ 4.0 │
#> │ 8.0 ┆ 5.0 │
#> └─────┴─────┘