class_docstr: Namespace for list related methods.
class_docstr_tok: ["Namespace","for","list","related","methods","."]
docstr: Sample from this list.
  
  Parameters
  ----------
  n
      Number of items to return. Cannot be used with `fraction`. Defaults to 1 if
      `fraction` is None.
  fraction
      Fraction of items to return. Cannot be used with `n`.
  with_replacement
      Allow values to be sampled more than once.
  shuffle
      Shuffle the order of sampled data points.
  seed
      Seed for the random number generator. If set to None (default), a
      random seed is generated for each sample operation.
  
  Examples
  --------
  >>> s = pl.Series("values", [[1, 2, 3], [4, 5]])
  >>> s.list.sample(n=pl.Series("n", [2, 1]), seed=1)
  shape: (2,)
  Series: 'values' [list[i64]]
  [
      [2, 1]
      [5]
  ]
docstr_tok: ["Sample","from","this","list",".","Parameters","--","--","--","--","--","n","Number","of","items","to","return",".","Can","not","be","used","with","`","fraction","`",".","Defaults","to","1","if","`","fraction","`","is","None",".","fraction","Fraction","of","items","to","return",".","Can","not","be","used","with","`","n","`",".","with_replacement","Allow","values","to","be","sampled","more","than","once",".","shuffle","Shuffle","the","order","of","sampled","data","points",".","seed","Seed","for","the","random","number","generator",".","If","set","to","None","(","default",")",",","a","random","seed","is","generated","for","each","sample","operation",".","Examples","--","--","--","--",">",">",">","s","=","pl.Series","(","``","values","''",",","[","[","1",",","2",",","3","]",",","[","4",",","5","]","]",")",">",">",">","s.list.sample","(","n=pl.Series","(","``","n","''",",","[","2",",","1","]",")",",","seed=1",")","shape",":","(","2",",",")","Series",":","'values","'","[","list","[","i64","]","]","[","[","2",",","1","]","[","5","]","]"]
code: def sample(
      self,
      n: int | IntoExprColumn | None = None,
      *,
      fraction: float | IntoExprColumn | None = None,
      with_replacement: bool = False,
      shuffle: bool = False,
      seed: int | None = None,
  ) -> Series:
      """
      Sample from this list.
  
      Parameters
      ----------
      n
          Number of items to return. Cannot be used with `fraction`. Defaults to 1 if
          `fraction` is None.
      fraction
          Fraction of items to return. Cannot be used with `n`.
      with_replacement
          Allow values to be sampled more than once.
      shuffle
          Shuffle the order of sampled data points.
      seed
          Seed for the random number generator. If set to None (default), a
          random seed is generated for each sample operation.
  
      Examples
      --------
      >>> s = pl.Series("values", [[1, 2, 3], [4, 5]])
      >>> s.list.sample(n=pl.Series("n", [2, 1]), seed=1)
      shape: (2,)
      Series: 'values' [list[i64]]
      [
          [2, 1]
          [5]
      ]
  
      """
  
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 6 for calling the ListNameSpace obj's underlying member method code with example usage: obj.sample(n) without return types