Skip to content

Return the number of non-null elements for each column

Description

Return the number of non-null elements for each column

Usage

<LazyFrame>$count()

Value

A polars LazyFrame

Examples

library("polars")

lf <- pl$LazyFrame(a = 1:4, b = c(1, 2, 1, NA), c = rep(NA, 4))
lf$count()$collect()
#> shape: (1, 3)
#> ┌─────┬─────┬─────┐
#> │ a   ┆ b   ┆ c   │
#> │ --- ┆ --- ┆ --- │
#> │ u32 ┆ u32 ┆ u32 │
#> ╞═════╪═════╪═════╡
#> │ 4   ┆ 3   ┆ 0   │
#> └─────┴─────┴─────┘