polars.Expr.drop_nulls#
- Expr.drop_nulls() Self [source]#
Drop all null values.
Warning
Note that null values are not floating point NaN values! To drop NaN values, use
drop_nans()
.Examples
>>> df = pl.DataFrame( ... { ... "a": [8, 9, 10, 11], ... "b": [None, 4.0, 4.0, float("nan")], ... } ... ) >>> df.select(pl.col("b").drop_nulls()) shape: (3, 1) ┌─────┐ │ b │ │ --- │ │ f64 │ ╞═════╡ │ 4.0 │ │ 4.0 │ │ NaN │ └─────┘