Function arrow::compute::kernels::window::shift [−][src]
pub fn shift<T>(values: &PrimitiveArray<T>, offset: i64) -> Result<ArrayRef> where
T: ArrowPrimitiveType,
Expand description
Shifts array by defined number of items (to left or right)
A positive value for offset
shifts the array to the right
a negative value shifts the array to the left.
Examples
use arrow::array::Int32Array; use arrow::error::Result; use arrow::compute::shift; let a: Int32Array = vec![Some(1), None, Some(4)].into(); // shift array 1 element to the right let res = shift(&a, 1).unwrap(); let expected: Int32Array = vec![None, Some(1), None].into(); assert_eq!(res.as_ref(), &expected)