Function polars::export::arrow::compute::arithmetics::basic::checked_div_scalar
source · [−]pub fn checked_div_scalar<T>(
lhs: &PrimitiveArray<T>,
rhs: &T
) -> PrimitiveArray<T> where
T: NativeArithmetics + CheckedDiv<Output = T>,
This is supported on crate feature
compute_arithmetics
only.Expand description
Checked division of a primitive array of type T by a scalar T. If the divisor is zero then the validity array is changed to None.
Examples
use arrow2::compute::arithmetics::basic::checked_div_scalar;
use arrow2::array::Int8Array;
let a = Int8Array::from(&[Some(-100i8)]);
let result = checked_div_scalar(&a, &100i8);
let expected = Int8Array::from(&[Some(-1i8)]);
assert_eq!(result, expected);