Skip to content

Count null values

Source code

Description

Create a new DataFrame that shows the null (which correspond to NA in R) counts per column.

Usage

<DataFrame>$null_count()

Format

function

Value

DataFrame

Examples

library("polars")

x = mtcars
x[1, 2:3] = NA
pl$DataFrame(x)$null_count()
#> shape: (1, 11)
#> ┌─────┬─────┬──────┬─────┬───┬─────┬─────┬──────┬──────┐
#> │ mpg ┆ cyl ┆ disp ┆ hp  ┆ … ┆ vs  ┆ am  ┆ gear ┆ carb │
#> │ --- ┆ --- ┆ ---  ┆ --- ┆   ┆ --- ┆ --- ┆ ---  ┆ ---  │
#> │ u32 ┆ u32 ┆ u32  ┆ u32 ┆   ┆ u32 ┆ u32 ┆ u32  ┆ u32  │
#> ╞═════╪═════╪══════╪═════╪═══╪═════╪═════╪══════╪══════╡
#> │ 0   ┆ 1   ┆ 1    ┆ 0   ┆ … ┆ 0   ┆ 0   ┆ 0    ┆ 0    │
#> └─────┴─────┴──────┴─────┴───┴─────┴─────┴──────┴──────┘