pub fn negate<T>(array: &PrimitiveArray<T>) -> PrimitiveArray<T> where
T: NativeType + Neg<Output = T>,
This is supported on crate feature
compute_arithmetics
only.Expand description
Negates values from array.
Examples
use arrow2::compute::arithmetics::basic::negate;
use arrow2::array::PrimitiveArray;
let a = PrimitiveArray::from([None, Some(6), None, Some(7)]);
let result = negate(&a);
let expected = PrimitiveArray::from([None, Some(-6), None, Some(-7)]);
assert_eq!(result, expected)