Available on crate feature
compute_window
only.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 arrow2::array::Int32Array;
use arrow2::compute::window::shift;
let array = Int32Array::from(&[Some(1), None, Some(3)]);
let result = shift(&array, -1).unwrap();
let expected = Int32Array::from(&[None, Some(3), None]);
assert_eq!(expected, result.as_ref());