Skip to content

Drop all floating point null values

Description

The original order of the remaining elements is preserved. A null value is not the same as a NaN value. To drop NaN values, use $drop_nans().

Usage

<Expr>$drop_nulls()

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = c(1, NA, 3, NaN))
df$select(pl$col("a")$drop_nulls())
#> shape: (3, 1)
#> ┌─────┐
#> │ a   │
#> │ --- │
#> │ f64 │
#> ╞═════╡
#> │ 1.0 │
#> │ 3.0 │
#> │ NaN │
#> └─────┘