class_docstr: Namespace for list related methods.
class_docstr_tok: ["Namespace","for","list","related","methods","."]
docstr: Shift list values by the given number of indices.
  
  Parameters
  ----------
  n
      Number of indices to shift forward. If a negative value is passed, values
      are shifted in the opposite direction instead.
  
  Notes
  -----
  This method is similar to the `LAG` operation in SQL when the value for `n`
  is positive. With a negative value for `n`, it is similar to `LEAD`.
  
  Examples
  --------
  By default, list values are shifted forward by one index.
  
  >>> s = pl.Series([[1, 2, 3], [4, 5]])
  >>> s.list.shift()
  shape: (2,)
  Series: '' [list[i64]]
  [
          [null, 1, 2]
          [null, 4]
  ]
  
  Pass a negative value to shift in the opposite direction instead.
  
  >>> s.list.shift(-2)
  shape: (2,)
  Series: '' [list[i64]]
  [
          [3, null, null]
          [null, null]
  ]
docstr_tok: ["Shift","list","values","by","the","given","number","of","indices",".","Parameters","--","--","--","--","--","n","Number","of","indices","to","shift","forward",".","If","a","negative","value","is","passed",",","values","are","shifted","in","the","opposite","direction","instead",".","Notes","--","--","-","This","method","is","similar","to","the","`","LAG","`","operation","in","SQL","when","the","value","for","`","n","`","is","positive",".","With","a","negative","value","for","`","n","`",",","it","is","similar","to","`","LEAD","`",".","Examples","--","--","--","--","By","default",",","list","values","are","shifted","forward","by","one","index",".",">",">",">","s","=","pl.Series","(","[","[","1",",","2",",","3","]",",","[","4",",","5","]","]",")",">",">",">","s.list.shift","(",")","shape",":","(","2",",",")","Series",":","``","[","list","[","i64","]","]","[","[","null",",","1",",","2","]","[","null",",","4","]","]","Pass","a","negative","value","to","shift","in","the","opposite","direction","instead",".",">",">",">","s.list.shift","(","-2",")","shape",":","(","2",",",")","Series",":","``","[","list","[","i64","]","]","[","[","3",",","null",",","null","]","[","null",",","null","]","]"]
code: def shift(self, n: int | IntoExprColumn = 1) -> Series:
      """
      Shift list values by the given number of indices.
  
      Parameters
      ----------
      n
          Number of indices to shift forward. If a negative value is passed, values
          are shifted in the opposite direction instead.
  
      Notes
      -----
      This method is similar to the `LAG` operation in SQL when the value for `n`
      is positive. With a negative value for `n`, it is similar to `LEAD`.
  
      Examples
      --------
      By default, list values are shifted forward by one index.
  
      >>> s = pl.Series([[1, 2, 3], [4, 5]])
      >>> s.list.shift()
      shape: (2,)
      Series: '' [list[i64]]
      [
              [null, 1, 2]
              [null, 4]
      ]
  
      Pass a negative value to shift in the opposite direction instead.
  
      >>> s.list.shift(-2)
      shape: (2,)
      Series: '' [list[i64]]
      [
              [3, null, null]
              [null, null]
      ]
  
      """
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, Callable, Sequence
  from polars import functions
  from polars.series.utils import expr_dispatch
  from polars.utils._wrap import wrap_s
  from polars.utils.deprecation import deprecate_renamed_function, deprecate_renamed_parameter
label_desc: Use image node_id 25 for calling the ListNameSpace obj's underlying member method code with example usage: obj.shift(n) without return types