convert_and_bound_index

Function convert_and_bound_index 

Source
pub fn convert_and_bound_index(
    s: &Series,
    target_len: usize,
    null_on_oob: bool,
) -> Result<ChunkedArray<UInt32Type>, PolarsError>
Available on crate feature polars-ops only.
Expand description

Convert arbitrary integer Series into IdxCa, using target_len as logical length.

  • All OOB indices are mapped to null in convert_*.
  • We track null counts before and after:
    • if null_on_oob == true, extra nulls are expected and we just return.
    • if null_on_oob == false and new nulls appear, we raise OutOfBounds.