./../api/polars.exceptions.SchemaError.html)
    * [ polars.exceptions.SchemaFieldNotFoundError ](../../api/polars.exceptions.SchemaFieldNotFoundError.html)
    * [ polars.exceptions.ShapeError ](../../api/polars.exceptions.ShapeError.html)
    * [ polars.exceptions.StructFieldNotFoundError ](../../api/polars.exceptions.StructFieldNotFoundError.html)
    * [ polars.exceptions.TooManyRowsReturnedError ](../../api/polars.exceptions.TooManyRowsReturnedError.html)

  * [ Testing ](../../testing.html) __
    * [ polars.testing.assert_frame_equal ](../../api/polars.testing.assert_frame_equal.html)
    * [ polars.testing.assert_frame_not_equal ](../../api/polars.testing.assert_frame_not_equal.html)
    * [ polars.testing.assert_series_equal ](../../api/polars.testing.assert_series_equal.html)
    * [ polars.testing.assert_series_not_equal ](../../api/polars.testing.assert_series_not_equal.html)
    * [ polars.testing.parametric.dataframes ](../../api/polars.testing.parametric.dataframes.html)
    * [ polars.testing.parametric.series ](../../api/polars.testing.parametric.series.html)
    * [ polars.testing.parametric.column ](../../api/polars.testing.parametric.column.html)
    * [ polars.testing.parametric.columns ](../../api/polars.testing.parametric.columns.html)
    * [ polars.testing.parametric.create_list_strategy ](../../api/polars.testing.parametric.create_list_strategy.html)
    * [ polars.testing.parametric.load_profile ](../../api/polars.testing.parametric.load_profile.html)
    * [ polars.testing.parametric.set_profile ](../../api/polars.testing.parametric.set_profile.html)

  * [ Metadata ](../../metadata.html) __
    * [ polars.build_info ](../../api/polars.build_info.html)
    * [ polars.get_index_type ](../../api/polars.get_index_type.html)
    * [ polars.show_versions ](../../api/polars.show_versions.html)
    * [ polars.thread_pool_size ](../../api/polars.thread_pool_size.html)
    * [ polars.threadpool_size ](../../api/polars.threadpool_size.html)

  * [ __ ](../../../index.html)
  * [ Python API reference ](../../index.html)
  * __
  * [ List ](../list.html)
  * polars.Serie... 

#  polars.Series.list.sample  #

Series.list.  sample  (

     _ n  :  [ int  ](https://docs.python.org/3/library/functions.html#int "\(in Python v3.12\)") |  IntoExprColumn  |  [ None  ](https://docs.python.org/3/library/constants.html#None "\(in Python v3.12\)") =  None  _ , 
     _ *  _ , 
     _ fraction  :  [ float  ](https://docs.python.org/3/library/functions.html#float "\(in Python v3.12\)") |  IntoExprColumn  |  [ None  ](https://docs.python.org/3/library/constants.html#None "\(in Python v3.12\)") =  None  _ , 
     _ with_replacement  :  [ bool  ](https://docs.python.org/3/library/functions.html#bool "\(in Python v3.12\)") =  False  _ , 
     _ shuffle  :  [ bool  ](https://docs.python.org/3/library/functions.html#bool "\(in Python v3.12\)") =  False  _ , 
     _ seed  :  [ int  ](https://docs.python.org/3/library/functions.html#int "\(in Python v3.12\)") |  [ None  ](https://docs.python.org/3/library/constants.html#None "\(in Python v3.12\)") =  None  _ , 
)  →  Series  [ [source]  ](https://github.com/pola-
rs/polars/blob/py-0.20.23/py-polars/polars/series/list.py#L133-L170) #

    

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]
    ]
    

[ __ previous  polars.Ser