polars.DataFrame.fill_nan
-
Fill floating point NaN values by an Expression evaluation.
- Parameters:
-
- value
-
Value used to fill NaN values.
- Returns:
-
- DataFrame
-
DataFrame with NaN values replaced by the given value.
See also
Notes
A NaN value is not the same as a null value. To fill null values, use
fill_null().Examples
>>> df = pl.DataFrame( ... { ... "a": [1.5, 2, float("nan"), 4], ... "b": [0.5, 4, float("nan"), 13], ... } ... ) >>> df.fill_nan(99) shape: (4, 2) ┌──────┬──────┐ │ a ┆ b │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════╡ │ 1.5 ┆ 0.5 │ │ 2.0 ┆ 4.0 │ │ 99.0 ┆ 99.0 │ │ 4.0 ┆ 13.0 │ └──────┴──────┘
DataFrame.fill_nan(
value: Expr | int | float | None,
) → DataFrame
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.fill_nan.html