diff --git a/crates/polars-core/src/chunked_array/ops/fill_null.rs b/crates/polars-core/src/chunked_array/ops/fill_null.rs index 9788b3b6ca55..5075a5f4bdad 100644 --- a/crates/polars-core/src/chunked_array/ops/fill_null.rs +++ b/crates/polars-core/src/chunked_array/ops/fill_null.rs @@ -20,6 +20,10 @@ impl Series { /// * Mean fill (replace None with the mean of the whole array) /// * Min fill (replace None with the minimum of the whole array) /// * Max fill (replace None with the maximum of the whole array) + /// * Zero fill (replace None with the value zero) + /// * One fill (replace None with the value one) + /// * MinBound fill (replace with the minimum of that data type) + /// * MaxBound fill (replace with the maximum of that data type) /// /// *NOTE: If you want to fill the Nones with a value use the /// [`fill_null` operation on `ChunkedArray`](crate::chunked_array::ops::ChunkFillNullValue)*. @@ -46,6 +50,18 @@ impl Series { /// let filled = s.fill_null(FillNullStrategy::Mean)?; /// assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(1), Some(2)]); /// + /// let filled = s.fill_null(FillNullStrategy::Zero)?; + /// assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(0), Some(2)]); + /// + /// let filled = s.fill_null(FillNullStrategy::One)?; + /// assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(1), Some(2)]); + /// + /// let filled = s.fill_null(FillNullStrategy::MinBound)?; + /// assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(-2147483648), Some(2)]); + /// + /// let filled = s.fill_null(FillNullStrategy::MaxBound)?; + /// assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(2147483647), Some(2)]); + /// /// Ok(()) /// } /// example();