xarray.IndexVariable.shift

IndexVariable.shift(shifts=None, fill_value=<NA>, **shifts_kwargs)

Return a new Variable with shifted data.

Parameters
  • shifts (mapping of the form {dim: offset}) – Integer offset to shift along each of the given dimensions. Positive offsets shift to the right; negative offsets shift to the left.

  • fill_value (scalar, optional) – Value to use for newly missing values

  • **shifts_kwargs – The keyword arguments form of shifts. One of shifts or shifts_kwargs must be provided.

Returns

shifted – Variable with the same dimensions and attributes but shifted data.

Return type

Variable