Skip to content

Return the number of rows in the context.

Source code

Description

This is similar to COUNT(*) in SQL.

Usage

pl$len()

Value

Expression of data type UInt32

See Also

  • \$count()

Examples

library("polars")

df = pl$DataFrame(
  a = c(1, 2, NA),
  b = c(3, NA, NA),
  c = c("foo", "bar", "foo")
)

df$select(pl$len())
#> shape: (1, 1)
#> ┌─────┐
#> │ len │
#> │ --- │
#> │ u32 │
#> ╞═════╡
#> │ 3   │
#> └─────┘