class_docstr: Namespace for list related expressions.
class_docstr_tok: ["Namespace","for","list","related","expressions","."]
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.
  
  >>> df = pl.DataFrame({"a": [[1, 2, 3], [4, 5]]})
  >>> df.with_columns(shift=pl.col("a").list.shift())
  shape: (2, 2)
  ┌───────────┬──────────────┐
  │ a         ┆ shift        │
  │ ---       ┆ ---          │
  │ list[i64] ┆ list[i64]    │
  ╞═══════════╪══════════════╡
  │ [1, 2, 3] ┆ [null, 1, 2] │
  │ [4, 5]    ┆ [null, 4]    │
  └───────────┴──────────────┘
  
  Pass a negative value to shift in the opposite direction instead.
  
  >>> df.with_columns(shift=pl.col("a").list.shift(-2))
  shape: (2, 2)
  ┌───────────┬─────────────────┐
  │ a         ┆ shift           │
  │ ---       ┆ ---             │
  │ list[i64] ┆ list[i64]       │
  ╞═══════════╪═════════════════╡
  │ [1, 2, 3] ┆ [3, null, null] │
  │ [4, 5]    ┆ [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",".",">",">",">","df","=","pl.DataFrame","(","{","``","a","''",":","[","[","1",",","2",",","3","]",",","[","4",",","5","]","]","}",")",">",">",">","df.with_columns","(","shift=pl.col","(","``","a","''",")",".list.shift","(",")",")","shape",":","(","2",",","2",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","a","\u2506","shift","\u2502","\u2502","--","-","\u2506","--","-","\u2502","\u2502","list","[","i64","]","\u2506","list","[","i64","]","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","[","1",",","2",",","3","]","\u2506","[","null",",","1",",","2","]","\u2502","\u2502","[","4",",","5","]","\u2506","[","null",",","4","]","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518","Pass","a","negative","value","to","shift","in","the","opposite","direction","instead",".",">",">",">","df.with_columns","(","shift=pl.col","(","``","a","''",")",".list.shift","(","-2",")",")","shape",":","(","2",",","2",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","a","\u2506","shift","\u2502","\u2502","--","-","\u2506","--","-","\u2502","\u2502","list","[","i64","]","\u2506","list","[","i64","]","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","[","1",",","2",",","3","]","\u2506","[","3",",","null",",","null","]","\u2502","\u2502","[","4",",","5","]","\u2506","[","null",",","null","]","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"]
code: def shift(self, n: int | IntoExprColumn = 1) -> Expr:
      """
      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.
  
      >>> df = pl.DataFrame({"a": [[1, 2, 3], [4, 5]]})
      >>> df.with_columns(shift=pl.col("a").list.shift())
      shape: (2, 2)
      ┌───────────┬──────────────┐
      │ a         ┆ shift        │
      │ ---       ┆ ---          │
      │ list[i64] ┆ list[i64]    │
      ╞═══════════╪══════════════╡
      │ [1, 2, 3] ┆ [null, 1, 2] │
      │ [4, 5]    ┆ [null, 4]    │
      └───────────┴──────────────┘
  
      Pass a negative value to shift in the opposite direction instead.
  
      >>> df.with_columns(shift=pl.col("a").list.shift(-2))
      shape: (2, 2)
      ┌───────────┬─────────────────┐
      │ a         ┆ shift           │
      │ ---       ┆ ---             │
      │ list[i64] ┆ list[i64]       │
      ╞═══════════╪═════════════════╡
      │ [1, 2, 3] ┆ [3, null, null] │
      │ [4, 5]    ┆ [null, null]    │
      └───────────┴─────────────────┘
  
      """
      n = parse_as_expression(n)
      return wrap_expr(self._pyexpr.list_shift(n))
  
imports: from __future__ import annotations
  import copy
  from typing import TYPE_CHECKING, Any, Callable, Sequence
  import polars._reexport
  from polars import functions
  from polars.utils._parse_expr_input import parse_as_expression
  from polars.utils._wrap import wrap_expr
  from polars.utils.deprecation import deprecate_renamed_function, deprecate_renamed_parameter
label_desc: Use image node_id 25 for calling the ExprListNameSpace obj's underlying member method code with example usage: obj.shift(n) and returns: wrap_expr