class_docstr: Namespace for list related methods.
class_docstr_tok: ["Namespace","for","list","related","methods","."]
docstr: Calculate the first discrete difference between shifted items of every sublist.
  
  Parameters
  ----------
  n
      Number of slots to shift.
  null_behavior : {'ignore', 'drop'}
      How to handle null values.
  
  Examples
  --------
  >>> s = pl.Series("a", [[1, 2, 3, 4], [10, 2, 1]])
  >>> s.list.diff()
  shape: (2,)
  Series: 'a' [list[i64]]
  [
      [null, 1, … 1]
      [null, -8, -1]
  ]
  
  >>> s.list.diff(n=2)
  shape: (2,)
  Series: 'a' [list[i64]]
  [
      [null, null, … 2]
      [null, null, -9]
  ]
  
  >>> s.list.diff(n=2, null_behavior="drop")
  shape: (2,)
  Series: 'a' [list[i64]]
  [
      [2, 2]
      [-9]
  ]
docstr_tok: ["Calculate","the","first","discrete","difference","between","shifted","items","of","every","sublist",".","Parameters","--","--","--","--","--","n","Number","of","slots","to","shift",".","null_behavior",":","{","'ignore","'",",","'drop","'","}","How","to","handle","null","values",".","Examples","--","--","--","--",">",">",">","s","=","pl.Series","(","``","a","''",",","[","[","1",",","2",",","3",",","4","]",",","[","10",",","2",",","1","]","]",")",">",">",">","s.list.diff","(",")","shape",":","(","2",",",")","Series",":","'","a","'","[","list","[","i64","]","]","[","[","null",",","1",",","\u2026","1","]","[","null",",","-8",",","-1","]","]",">",">",">","s.list.diff","(","n=2",")","shape",":","(","2",",",")","Series",":","'","a","'","[","list","[","i64","]","]","[","[","null",",","null",",","\u2026","2","]","[","null",",","null",",","-9","]","]",">",">",">","s.list.diff","(","n=2",",","null_behavior=","''","drop","''",")","shape",":","(","2",",",")","Series",":","'","a","'","[","list","[","i64","]","]","[","[","2",",","2","]","[","-9","]","]"]
code: def diff(
      self, n: int = 1, null_behavior: NullBehavior = "ignore"
  ) -> Series:
      """
      Calculate the first discrete difference between shifted items of every sublist.
  
      Parameters
      ----------
      n
          Number of slots to shift.
      null_behavior : {'ignore', 'drop'}
          How to handle null values.
  
      Examples
      --------
      >>> s = pl.Series("a", [[1, 2, 3, 4], [10, 2, 1]])
      >>> s.list.diff()
      shape: (2,)
      Series: 'a' [list[i64]]
      [
          [null, 1, … 1]
          [null, -8, -1]
      ]
  
      >>> s.list.diff(n=2)
      shape: (2,)
      Series: 'a' [list[i64]]
      [
          [null, null, … 2]
          [null, null, -9]
      ]
  
      >>> s.list.diff(n=2, null_behavior="drop")
      shape: (2,)
      Series: 'a' [list[i64]]
      [
          [2, 2]
          [-9]
      ]
  
      """
  
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 24 for calling the ListNameSpace obj's underlying member method code with example usage: obj.diff(n, null_behavior) without return types