Skip to main content

Column.offset

offsetnfill_with

Group: Values
Aliases: displace, lag, lead, shift, slide

Documentation

Returns a new column offset by n rows, where missing values have been replaced with the provided fill_with strategy.

Arguments

  • n: The number of rows to offset the new column by. Negative n slides the values down in the column, adding records at the start. Positive n slides the values up in the column, adding records at the end. Defaults to -1.
  • fill_with: The value to replace missing values with. Defaults to adding Nothing Values.
  • -: ..Nothing - Add Nothing values in the spaces created by sliding the existing values.
  • -: ..Closest_Value - If n is negative the first value gets used, if n is negative the last value gets used.
  • -: ..Wrap_Around - In this mode values that slide off the top or bottom reappear at the other end. So no values get lost they are just rotated.