pub fn sub<T>(
lhs: &PrimitiveArray<T>,
rhs: &PrimitiveArray<T>
) -> PrimitiveArray<T> where
T: NativeArithmetics + Sub<Output = T>,
Expand description
Subtracts two primitive arrays with the same type. Panics if the subtraction of one pair of values overflows.
Examples
use arrow2::compute::arithmetics::basic::sub;
use arrow2::array::Int32Array;
let a = Int32Array::from(&[None, Some(6), None, Some(6)]);
let b = Int32Array::from(&[Some(5), None, None, Some(6)]);
let result = sub(&a, &b);
let expected = Int32Array::from(&[None, None, None, Some(0)]);
assert_eq!(result, expected)