polars_arrow::compute::arity_assign

Function unary

Source
pub fn unary<I, F>(array: &mut PrimitiveArray<I>, op: F)
where I: NativeType, F: Fn(I) -> I,
Expand description

Applies an unary function to a PrimitiveArray, optionally in-place.

§Implementation

This function tries to apply the function directly to the values of the array. If that region is shared, this function creates a new region and writes to it.

§Panics

This function panics iff

  • the arrays have a different length.
  • the function itself panics.