Function polars::export::arrow::compute::arithmetics::basic::div_scalar
source · [−]pub fn div_scalar<T>(lhs: &PrimitiveArray<T>, rhs: &T) -> PrimitiveArray<T> where
T: NativeArithmetics + Div<T, Output = T> + NumCast,
This is supported on crate feature
compute_arithmetics
only.Expand description
Divide a primitive array of type T by a scalar T. Panics if the divisor is zero.
Examples
use arrow2::compute::arithmetics::basic::div_scalar;
use arrow2::array::Int32Array;
let a = Int32Array::from(&[None, Some(6), None, Some(6)]);
let result = div_scalar(&a, &2i32);
let expected = Int32Array::from(&[None, Some(3), None, Some(3)]);
assert_eq!(result, expected)