Skip to content

Commit

Permalink
docs(rust): fill missing fill_null strategies (#11751)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrosbar authored Oct 16, 2023
1 parent 92d4dea commit 03b83ee
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/polars-core/src/chunked_array/ops/fill_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>`](crate::chunked_array::ops::ChunkFillNullValue)*.
Expand All @@ -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();
Expand Down

0 comments on commit 03b83ee

Please sign in to comment.