Skip to content

Count missing values

Source code

Description

Count missing values

Usage

<Expr>$null_count()

Value

Expr

Examples

library("polars")

pl$DataFrame(x = c(NA, "a", NA, "b"))$
  with_columns(n_missing = pl$col("x")$null_count())
#> shape: (4, 2)
#> ┌──────┬───────────┐
#> │ x    ┆ n_missing │
#> │ ---  ┆ ---       │
#> │ str  ┆ u32       │
#> ╞══════╪═══════════╡
#> │ null ┆ 2         │
#> │ a    ┆ 2         │
#> │ null ┆ 2         │
#> │ b    ┆ 2         │
#> └──────┴───────────┘