§
    Ҭ¸ju ã                  óþ   — d dl mZ d dlZd dlmZmZ d dlmZmZ d dl	m
Z d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZmZ d dlmZ d dlmZ erd dlmZ d dlmZmZ d dl m!Z!m"Z"m#Z#m$Z$  G d„ de¦  «        Z%dS )é    )ÚannotationsN)Ú
CollectionÚSequence)ÚTYPE_CHECKINGÚAny)Ú
exceptions)Ú	functions)Úissue_deprecation_warning)Úparse_into_expression)Úunstable)Ú_NamespaceSuggestMixinÚ_Omitted)Ú	wrap_expr)Úissue_warning)ÚCallable)ÚExprÚSeries)ÚIntoExprÚIntoExprColumnÚListToStructWidthStrategyÚNullBehaviorc                  ó  — e Zd ZdZdZdtd„Zdud
„Zddœdvd„Zddœdvd„Zdwd„Z	dwd„Z
	 dxdddddœdyd„Zdwd „Zdwd!„Zdwd"„Zdwd#„Zdwd$„Zdzd{d'„Zdzd{d(„Zddd)œd|d,„Zdwd-„Zdd.œd}d0„Zdwd1„Zd~d4„Zdd5œdd9„Zdd5œd€d<„Z	 d�d‚d@„ZdwdA„ZdwdB„Z e¦   «         ddCœdƒdE„¦   «         ZddFœd„dI„Zddœd…dL„Z dwdM„Z!dwdN„Z"d†d‡dR„Z#dzdˆdS„Z$	 dxd‰dW„Z%dŠd‹dY„Z&dŠd‹dZ„Z'e(dd[œdŒd^„Z)d�d`„Z*dŽdb„Z+	 	 	 d�d�dh„Z,ddiœd‘dk„Z-d’dl„Z.d“dn„Z/d”dp„Z0d”dq„Z1d”dr„Z2d”ds„Z3dS )•ÚExprListNameSpacez'Namespace for list related expressions.ÚlistÚexprr   ÚreturnÚNonec                ó   — |j         | _         d S ©N)Ú_pyexpr©Úselfr   s     ú`/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/polars/expr/list.pyÚ__init__zExprListNameSpace.__init__"   s   € Ø”|ˆŒˆˆó    ÚitemÚintc                ó,   — |                       |¦  «        S )u„  
        Get the value by index in the sublists.

        This is syntactic sugar for :meth:`Expr.list.get`.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        item
            Index to return per sublist. Index ``0`` returns the first item, and
            index ``-1`` returns the last item.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[3, 2, 1], [4, 5, 6]]})
        >>> df.with_columns(get=pl.col("a").list[0])
        shape: (2, 2)
        ┌───────────┬─────┐
        │ a         ┆ get │
        │ ---       ┆ --- │
        │ list[i64] ┆ i64 │
        ╞═══════════╪═════╡
        │ [3, 2, 1] ┆ 3   │
        │ [4, 5, 6] ┆ 4   │
        └───────────┴─────┘
        ©Úget)r"   r&   s     r#   Ú__getitem__zExprListNameSpace.__getitem__%   s   € ð8 �xŠx˜‰~Œ~Ðr%   T©Úignore_nullsr-   Úboolc               óv   — |                       t          j        ¦   «                              |¬¦  «        ¦  «        S )uÂ  
        Evaluate whether all boolean values in a list are true.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        ignore_nulls
            * If set to `True` (default), null values are ignored. If there
              are no non-null values, the output is `True`.
            * If set to `False`, `Kleene logic`_ is used to deal with nulls:
              if the column contains any null values and no `False` values,
              the output is null.

            .. _Kleene logic: https://en.wikipedia.org/wiki/Three-valued_logic

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {"a": [[True, True], [False, True], [False, False], [None], [], None]}
        ... )
        >>> df.with_columns(all=pl.col("a").list.all())
        shape: (6, 2)
        ┌────────────────┬───────┐
        │ a              ┆ all   │
        │ ---            ┆ ---   │
        │ list[bool]     ┆ bool  │
        ╞════════════════╪═══════╡
        │ [true, true]   ┆ true  │
        │ [false, true]  ┆ false │
        │ [false, false] ┆ false │
        │ [null]         ┆ true  │
        │ []             ┆ true  │
        │ null           ┆ null  │
        └────────────────┴───────┘
        r,   )ÚaggÚFÚelementÚall©r"   r-   s     r#   r3   zExprListNameSpace.allC   ó+   € ðJ �xŠx�œ	™œŸš°\˜ÑBÔBÑCÔCÐCr%   c               óv   — |                       t          j        ¦   «                              |¬¦  «        ¦  «        S )uÀ  
        Evaluate whether any boolean value in a list is true.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        ignore_nulls
            * If set to `True` (default), null values are ignored. If there
              are no non-null values, the output is `False`.
            * If set to `False`, `Kleene logic`_ is used to deal with nulls:
              if the column contains any null values and no `True` values,
              the output is null.

            .. _Kleene logic: https://en.wikipedia.org/wiki/Three-valued_logic

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {"a": [[True, True], [False, True], [False, False], [None], [], None]}
        ... )
        >>> df.with_columns(any=pl.col("a").list.any())
        shape: (6, 2)
        ┌────────────────┬───────┐
        │ a              ┆ any   │
        │ ---            ┆ ---   │
        │ list[bool]     ┆ bool  │
        ╞════════════════╪═══════╡
        │ [true, true]   ┆ true  │
        │ [false, true]  ┆ true  │
        │ [false, false] ┆ false │
        │ [null]         ┆ false │
        │ []             ┆ false │
        │ null           ┆ null  │
        └────────────────┴───────┘
        r,   )r0   r1   r2   Úanyr4   s     r#   r7   zExprListNameSpace.anyj   r5   r%   c                óN   — t          | j                             ¦   «         ¦  «        S )uR  
        Return the number of elements in each list.

        Null values count towards the total.

        .. engine-support:: in-memory, streaming, distributed

        Returns
        -------
        Expr
            Expression of data type :class:`UInt32`.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[1, 2, None], [5]]})
        >>> df.with_columns(len=pl.col("a").list.len())
        shape: (2, 2)
        ┌──────────────┬─────┐
        │ a            ┆ len │
        │ ---          ┆ --- │
        │ list[i64]    ┆ u32 │
        ╞══════════════╪═════╡
        │ [1, 2, null] ┆ 3   │
        │ [5]          ┆ 1   │
        └──────────────┴─────┘
        )r   r    Úlist_len©r"   s    r#   ÚlenzExprListNameSpace.len‘   s    € õ6 ˜œ×.Ò.Ñ0Ô0Ñ1Ô1Ð1r%   c                óN   — t          | j                             ¦   «         ¦  «        S )uÒ  
        Drop all null values in the list.

        .. engine-support:: in-memory, streaming, distributed

        The original order of the remaining elements is preserved.

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[None, 1, None, 2], [None], [3, 4]]})
        >>> df.with_columns(drop_nulls=pl.col("values").list.drop_nulls())
        shape: (3, 2)
        ┌────────────────┬────────────┐
        │ values         ┆ drop_nulls │
        │ ---            ┆ ---        │
        │ list[i64]      ┆ list[i64]  │
        ╞════════════════╪════════════╡
        │ [null, 1, … 2] ┆ [1, 2]     │
        │ [null]         ┆ []         │
        │ [3, 4]         ┆ [3, 4]     │
        └────────────────┴────────────┘
        )r   r    Úlist_drop_nullsr:   s    r#   Ú
drop_nullszExprListNameSpace.drop_nulls®   s    € õ. ˜œ×5Ò5Ñ7Ô7Ñ8Ô8Ð8r%   NF)ÚfractionÚwith_replacementÚshuffleÚseedÚnúint | IntoExprColumn | Noner?   úfloat | IntoExprColumn | Noner@   rA   úbool | NonerB   ú
int | Nonec               ó  — |�|�d}t          |¦  «        ‚|�9t          |¦  «        }t          | j                             ||||¦  «        ¦  «        S |€d}t          |¦  «        }t          | j                             ||||¦  «        ¦  «        S )u%  
        Sample from this list.

        .. engine-support:: in-memory, streaming, distributed

        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
            Determines the order of the sampled values.
            If True, sampled values are explicitly shuffled.
            If False, the relative order of the sampled values is preserved.
            (i.e. they appear in the same order as the original input list).
            If None (default), no ordering guarantee; uses the most performant
            algorithm.
        seed
            Seed for the random number generator. If set to None (default), a
            random seed is generated for each sample operation.

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[1, 2, 3], [4, 5]], "n": [2, 1]})
        >>> df.with_columns(
        ...     sample=pl.col("values").list.sample(
        ...         n=pl.col("n"), shuffle=False, seed=1
        ...     )
        ... )
        shape: (2, 3)
        ┌───────────┬─────┬───────────┐
        │ values    ┆ n   ┆ sample    │
        │ ---       ┆ --- ┆ ---       │
        │ list[i64] ┆ i64 ┆ list[i64] │
        ╞═══════════╪═════╪═══════════╡
        │ [1, 2, 3] ┆ 2   ┆ [2, 3]    │
        │ [4, 5]    ┆ 1   ┆ [5]       │
        └───────────┴─────┴───────────┘
        Nz&cannot specify both `n` and `fraction`é   )Ú
ValueErrorr   r   r    Úlist_sample_fractionÚlist_sample_n)	r"   rC   r?   r@   rA   rB   ÚmsgÚfraction_pyexprÚn_pyexprs	            r#   ÚsamplezExprListNameSpace.sampleÇ   s©   € ðh ˆ=˜XÐ1Ø:ˆCÝ˜S‘/”/Ð!àÐÝ3°HÑ=Ô=ˆOÝØ”×1Ò1Ø#Ð%5°wÀñô ñô ð ð ˆ9ØˆAÝ(¨Ñ+Ô+ˆÝØŒL×&Ò& xÐ1AÀ7ÈDÑQÔQñ
ô 
ð 	
r%   c                óN   — t          | j                             ¦   «         ¦  «        S )uó  
        Sum all the lists in the array.

        .. engine-support:: in-memory, streaming, distributed

        Notes
        -----
        If there are no non-null elements in a row, the output is `0`.

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[1], [2, 3]]})
        >>> df.with_columns(sum=pl.col("values").list.sum())
        shape: (2, 2)
        ┌───────────┬─────┐
        │ values    ┆ sum │
        │ ---       ┆ --- │
        │ list[i64] ┆ i64 │
        ╞═══════════╪═════╡
        │ [1]       ┆ 1   │
        │ [2, 3]    ┆ 5   │
        └───────────┴─────┘
        )r   r    Úlist_sumr:   s    r#   ÚsumzExprListNameSpace.sum  s    € õ0 ˜œ×.Ò.Ñ0Ô0Ñ1Ô1Ð1r%   c                óN   — t          | j                             ¦   «         ¦  «        S )u   
        Compute the max value of the lists in the array.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[1], [2, 3]]})
        >>> df.with_columns(max=pl.col("values").list.max())
        shape: (2, 2)
        ┌───────────┬─────┐
        │ values    ┆ max │
        │ ---       ┆ --- │
        │ list[i64] ┆ i64 │
        ╞═══════════╪═════╡
        │ [1]       ┆ 1   │
        │ [2, 3]    ┆ 3   │
        └───────────┴─────┘
        )r   r    Úlist_maxr:   s    r#   ÚmaxzExprListNameSpace.max(  ó    € õ( ˜œ×.Ò.Ñ0Ô0Ñ1Ô1Ð1r%   c                óN   — t          | j                             ¦   «         ¦  «        S )u   
        Compute the min value of the lists in the array.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[1], [2, 3]]})
        >>> df.with_columns(min=pl.col("values").list.min())
        shape: (2, 2)
        ┌───────────┬─────┐
        │ values    ┆ min │
        │ ---       ┆ --- │
        │ list[i64] ┆ i64 │
        ╞═══════════╪═════╡
        │ [1]       ┆ 1   │
        │ [2, 3]    ┆ 2   │
        └───────────┴─────┘
        )r   r    Úlist_minr:   s    r#   ÚminzExprListNameSpace.min>  rW   r%   c                óN   — t          | j                             ¦   «         ¦  «        S )u±  
        Compute the mean value of the lists in the array.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[1], [2, 3]]})
        >>> df.with_columns(mean=pl.col("values").list.mean())
        shape: (2, 2)
        ┌───────────┬──────┐
        │ values    ┆ mean │
        │ ---       ┆ ---  │
        │ list[i64] ┆ f64  │
        ╞═══════════╪══════╡
        │ [1]       ┆ 1.0  │
        │ [2, 3]    ┆ 2.5  │
        └───────────┴──────┘
        )r   r    Ú	list_meanr:   s    r#   ÚmeanzExprListNameSpace.meanT  s    € õ( ˜œ×/Ò/Ñ1Ô1Ñ2Ô2Ð2r%   c                óN   — t          | j                             ¦   «         ¦  «        S )uò  
        Compute the median value of the lists in the array.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[-1, 0, 1], [1, 10]]})
        >>> df.with_columns(pl.col("values").list.median().alias("median"))
        shape: (2, 2)
        ┌────────────┬────────┐
        │ values     ┆ median │
        │ ---        ┆ ---    │
        │ list[i64]  ┆ f64    │
        ╞════════════╪════════╡
        │ [-1, 0, 1] ┆ 0.0    │
        │ [1, 10]    ┆ 5.5    │
        └────────────┴────────┘
        )r   r    Úlist_medianr:   s    r#   ÚmedianzExprListNameSpace.medianj  s    € õ( ˜œ×1Ò1Ñ3Ô3Ñ4Ô4Ð4r%   rI   Úddofc                óP   — t          | j                             |¦  «        ¦  «        S )uï  
        Compute the std value of the lists in the array.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        ddof
            “Delta Degrees of Freedom”: the divisor used in the calculation is N - ddof,
            where N represents the number of elements.
            By default ddof is 1.

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[-1, 0, 1], [1, 10]]})
        >>> df.with_columns(pl.col("values").list.std().alias("std"))
        shape: (2, 2)
        ┌────────────┬──────────┐
        │ values     ┆ std      │
        │ ---        ┆ ---      │
        │ list[i64]  ┆ f64      │
        ╞════════════╪══════════╡
        │ [-1, 0, 1] ┆ 1.0      │
        │ [1, 10]    ┆ 6.363961 │
        └────────────┴──────────┘
        )r   r    Úlist_std©r"   ra   s     r#   ÚstdzExprListNameSpace.std€  ó"   € õ6 ˜œ×.Ò.¨tÑ4Ô4Ñ5Ô5Ð5r%   c                óP   — t          | j                             |¦  «        ¦  «        S )u·  
        Compute the var value of the lists in the array.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        ddof
            “Delta Degrees of Freedom”: the divisor used in the calculation is N - ddof,
            where N represents the number of elements.
            By default ddof is 1.

        Examples
        --------
        >>> df = pl.DataFrame({"values": [[-1, 0, 1], [1, 10]]})
        >>> df.with_columns(pl.col("values").list.var().alias("var"))
        shape: (2, 2)
        ┌────────────┬──────┐
        │ values     ┆ var  │
        │ ---        ┆ ---  │
        │ list[i64]  ┆ f64  │
        ╞════════════╪══════╡
        │ [-1, 0, 1] ┆ 1.0  │
        │ [1, 10]    ┆ 40.5 │
        └────────────┴──────┘
        )r   r    Úlist_varrd   s     r#   ÚvarzExprListNameSpace.var�  rf   r%   )Ú
descendingÚ
nulls_lastrj   rk   c               óR   — t          | j                             ||¦  «        ¦  «        S )uâ  
        Sort the lists in this column.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        descending
            Sort in descending order.
        nulls_last
            Place null values last.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[3, 2, 1], [9, 1, 2]],
        ...     }
        ... )
        >>> df.with_columns(sort=pl.col("a").list.sort())
        shape: (2, 2)
        ┌───────────┬───────────┐
        │ a         ┆ sort      │
        │ ---       ┆ ---       │
        │ list[i64] ┆ list[i64] │
        ╞═══════════╪═══════════╡
        │ [3, 2, 1] ┆ [1, 2, 3] │
        │ [9, 1, 2] ┆ [1, 2, 9] │
        └───────────┴───────────┘
        >>> df.with_columns(sort=pl.col("a").list.sort(descending=True))
        shape: (2, 2)
        ┌───────────┬───────────┐
        │ a         ┆ sort      │
        │ ---       ┆ ---       │
        │ list[i64] ┆ list[i64] │
        ╞═══════════╪═══════════╡
        │ [3, 2, 1] ┆ [3, 2, 1] │
        │ [9, 1, 2] ┆ [9, 2, 1] │
        └───────────┴───────────┘
        )r   r    Ú	list_sort)r"   rj   rk   s      r#   ÚsortzExprListNameSpace.sortº  s%   € õR ˜œ×/Ò/°
¸JÑGÔGÑHÔHÐHr%   c                ór   — |                       t          j        ¦   «                              ¦   «         ¦  «        S )u/  
        Reverse the arrays in the list.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[3, 2, 1], [9, 1, 2]],
        ...     }
        ... )
        >>> df.with_columns(reverse=pl.col("a").list.reverse())
        shape: (2, 2)
        ┌───────────┬───────────┐
        │ a         ┆ reverse   │
        │ ---       ┆ ---       │
        │ list[i64] ┆ list[i64] │
        ╞═══════════╪═══════════╡
        │ [3, 2, 1] ┆ [1, 2, 3] │
        │ [9, 1, 2] ┆ [2, 1, 9] │
        └───────────┴───────────┘
        )Úevalr1   r2   Úreverser:   s    r#   rq   zExprListNameSpace.reverseå  s(   € ð0 �yŠy�œ™œ×,Ò,Ñ.Ô.Ñ/Ô/Ð/r%   ©Úmaintain_orderrs   c               óv   — |                       t          j        ¦   «                              |¬¦  «        ¦  «        S )u‡  
        Get the unique/distinct values in every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        maintain_order
            Maintain order of data. This requires more work.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 1, 2]],
        ...     }
        ... )
        >>> df.with_columns(unique=pl.col("a").list.unique())
        shape: (1, 2)
        ┌───────────┬───────────┐
        │ a         ┆ unique    │
        │ ---       ┆ ---       │
        │ list[i64] ┆ list[i64] │
        ╞═══════════╪═══════════╡
        │ [1, 1, 2] ┆ [1, 2]    │
        └───────────┴───────────┘
        rr   )rp   r1   r2   Úunique)r"   rs   s     r#   ru   zExprListNameSpace.uniqueÿ  s-   € ð8 �yŠy�œ™œ×+Ò+¸>Ð+ÑJÔJÑKÔKÐKr%   c                ór   — |                       t          j        ¦   «                              ¦   «         ¦  «        S )u8  
        Count the number of unique values in every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 1, 2], [2, 3, 4]],
        ...     }
        ... )
        >>> df.with_columns(n_unique=pl.col("a").list.n_unique())
        shape: (2, 2)
        ┌───────────┬──────────┐
        │ a         ┆ n_unique │
        │ ---       ┆ ---      │
        │ list[i64] ┆ u32      │
        ╞═══════════╪══════════╡
        │ [1, 1, 2] ┆ 2        │
        │ [2, 3, 4] ┆ 3        │
        └───────────┴──────────┘
        )r0   r1   r2   Ún_uniquer:   s    r#   rw   zExprListNameSpace.n_unique  s(   € ð0 �xŠx�œ	™œ×,Ò,Ñ.Ô.Ñ/Ô/Ð/r%   Úotherú2list[Expr | str] | Expr | str | Series | list[Any]c                ó°  — t          |t          ¦  «        rZt          |d         t          j        t          t          j        f¦  «        s(|                      t          j        |g¦  «        ¦  «        S t          |t          ¦  «        s|gnt          j        |¦  «        }|                     dt          | j
        ¦  «        ¦  «         t          j        |¦  «        S )uî  
        Concat the arrays in a Series dtype List in linear time.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        other
            Columns to concat into a List Series

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [["a"], ["x"]],
        ...         "b": [["b", "c"], ["y", "z"]],
        ...     }
        ... )
        >>> df.with_columns(concat=pl.col("a").list.concat("b"))
        shape: (2, 3)
        ┌───────────┬────────────┬─────────────────┐
        │ a         ┆ b          ┆ concat          │
        │ ---       ┆ ---        ┆ ---             │
        │ list[str] ┆ list[str]  ┆ list[str]       │
        ╞═══════════╪════════════╪═════════════════╡
        │ ["a"]     ┆ ["b", "c"] ┆ ["a", "b", "c"] │
        │ ["x"]     ┆ ["y", "z"] ┆ ["x", "y", "z"] │
        └───────────┴────────────┴─────────────────┘
        r   )Ú
isinstancer   Úplr   Ústrr   ÚconcatÚcopyÚinsertr   r    r1   Úconcat_list)r"   rx   Ú
other_lists      r#   r~   zExprListNameSpace.concat7  s­   € õ< �e�TÑ"Ô"ð 	3Ý˜5 œ8¥b¤g­sµB´IÐ%>Ñ?Ô?ð	3ð —;’;�rœy¨%¨Ñ1Ô1Ñ2Ô2Ð2õ %/¨uµdÑ$;Ô$;ÐQ�e�W�WÅÄÈ5ÑAQÔAQˆ
à×Ò˜!�Y t¤|Ñ4Ô4Ñ5Ô5Ð5ÝŒ}˜ZÑ(Ô(Ð(r%   ©Únull_on_oobÚindexúint | Expr | strr„   c               óp   — t          |¦  «        }t          | j                             ||¦  «        ¦  «        S )uŽ  
        Get the value by index in every sublist.

        .. engine-support:: in-memory, streaming, distributed

        So index `0` would return the first item of every sublist
        and index `-1` would return the last item of every sublist
        if an index is out of bounds, it will return a `None`.

        Parameters
        ----------
        index
            Index to return per sublist
        null_on_oob
            Behavior if an index is out of bounds:

            * True -> set as null
            * False -> raise an error

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[3, 2, 1], [], [1, 2]]})
        >>> df.with_columns(get=pl.col("a").list.get(0, null_on_oob=True))
        shape: (3, 2)
        ┌───────────┬──────┐
        │ a         ┆ get  │
        │ ---       ┆ ---  │
        │ list[i64] ┆ i64  │
        ╞═══════════╪══════╡
        │ [3, 2, 1] ┆ 3    │
        │ []        ┆ null │
        │ [1, 2]    ┆ 1    │
        └───────────┴──────┘
        )r   r   r    Úlist_get)r"   r…   r„   Úindex_pyexprs       r#   r*   zExprListNameSpace.get`  s2   € õP -¨UÑ3Ô3ˆÝ˜œ×.Ò.¨|¸[ÑIÔIÑJÔJÐJr%   Úindicesú+Expr | Series | list[int] | list[list[int]]c               óp   — t          |¦  «        }t          | j                             ||¦  «        ¦  «        S )u&  
        Take sub-lists by multiple indices.

        .. engine-support:: in-memory, streaming, distributed

        The indices may be defined in a single column, or by sublists in another
        column of dtype `List`.

        Parameters
        ----------
        indices
            Indices to return per sublist
        null_on_oob
            Behavior if an index is out of bounds:
            True -> set as null
            False -> raise an error
            Note that defaulting to raising an error is much cheaper

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[3, 2, 1], [], [1, 2, 3, 4, 5]]})
        >>> df.with_columns(gather=pl.col("a").list.gather([0, 4], null_on_oob=True))
        shape: (3, 2)
        ┌─────────────┬──────────────┐
        │ a           ┆ gather       │
        │ ---         ┆ ---          │
        │ list[i64]   ┆ list[i64]    │
        ╞═════════════╪══════════════╡
        │ [3, 2, 1]   ┆ [3, null]    │
        │ []          ┆ [null, null] │
        │ [1, 2, … 5] ┆ [1, 5]       │
        └─────────────┴──────────────┘
        )r   r   r    Úlist_gather)r"   rŠ   r„   Úindices_pyexprs       r#   ÚgatherzExprListNameSpace.gather‹  s2   € õN /¨wÑ7Ô7ˆÝ˜œ×1Ò1°.À+ÑNÔNÑOÔOÐOr%   r   úint | IntoExprColumnÚoffsetc                óŽ   — t          |¦  «        }t          |¦  «        }t          | j                             ||¦  «        ¦  «        S )u3  
        Take every n-th value start from offset in every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        n
            Gather every n-th element.
        offset
            Starting index.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 2, 3, 4, 5], [6, 7, 8], [9, 10, 11, 12]],
        ...         "n": [2, 1, 3],
        ...         "offset": [0, 1, 0],
        ...     }
        ... )
        >>> df.with_columns(
        ...     gather_every=pl.col("a").list.gather_every(
        ...         n=pl.col("n"), offset=pl.col("offset")
        ...     )
        ... )
        shape: (3, 4)
        ┌───────────────┬─────┬────────┬──────────────┐
        │ a             ┆ n   ┆ offset ┆ gather_every │
        │ ---           ┆ --- ┆ ---    ┆ ---          │
        │ list[i64]     ┆ i64 ┆ i64    ┆ list[i64]    │
        ╞═══════════════╪═════╪════════╪══════════════╡
        │ [1, 2, … 5]   ┆ 2   ┆ 0      ┆ [1, 3, 5]    │
        │ [6, 7, 8]     ┆ 1   ┆ 1      ┆ [7, 8]       │
        │ [9, 10, … 12] ┆ 3   ┆ 0      ┆ [9, 12]      │
        └───────────────┴─────┴────────┴──────────────┘
        )r   r   r    Úlist_gather_every)r"   rC   r‘   rO   Úoffset_pyexprs        r#   Úgather_everyzExprListNameSpace.gather_everyµ  s?   € õT )¨Ñ+Ô+ˆÝ-¨fÑ5Ô5ˆÝ˜œ×7Ò7¸À-ÑPÔPÑQÔQÐQr%   c                ó0   — |                       dd¬¦  «        S )uÚ  
        Get the first value of every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[3, 2, 1], [], [1, 2]]})
        >>> df.with_columns(first=pl.col("a").list.first())
        shape: (3, 2)
        ┌───────────┬───────┐
        │ a         ┆ first │
        │ ---       ┆ ---   │
        │ list[i64] ┆ i64   │
        ╞═══════════╪═══════╡
        │ [3, 2, 1] ┆ 3     │
        │ []        ┆ null  │
        │ [1, 2]    ┆ 1     │
        └───────────┴───────┘
        r   Trƒ   r)   r:   s    r#   ÚfirstzExprListNameSpace.firstã  s   € ð* �xŠx˜ tˆxÑ,Ô,Ð,r%   c                ó0   — |                       dd¬¦  «        S )uÈ  
        Get the last value of every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[3, 2, 1], [], [1, 2]]})
        >>> df.with_columns(last=pl.col("a").list.last())
        shape: (3, 2)
        ┌───────────┬──────┐
        │ a         ┆ last │
        │ ---       ┆ ---  │
        │ list[i64] ┆ i64  │
        ╞═══════════╪══════╡
        │ [3, 2, 1] ┆ 1    │
        │ []        ┆ null │
        │ [1, 2]    ┆ 2    │
        └───────────┴──────┘
        éÿÿÿÿTrƒ   r)   r:   s    r#   ÚlastzExprListNameSpace.lastú  s   € ð* �xŠx˜¨ˆxÑ-Ô-Ð-r%   ©Úallow_emptyrœ   c               óv   — |                       t          j        ¦   «                              |¬¦  «        ¦  «        S )uT  
        Get the single value of the sub-list.

        .. engine-support:: in-memory, streaming, distributed

        This errors if the sublist length is not exactly one.

        Parameters
        ----------
        allow_empty
            Allow having no values to return `null`.

        See Also
        --------
        :meth:`Expr.list.get` : Get the value by index in the sublists.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[3], [1], [2]]})
        >>> df.with_columns(item=pl.col("a").list.item())
        shape: (3, 2)
        ┌───────────┬──────┐
        │ a         ┆ item │
        │ ---       ┆ ---  │
        │ list[i64] ┆ i64  │
        ╞═══════════╪══════╡
        │ [3]       ┆ 3    │
        │ [1]       ┆ 1    │
        │ [2]       ┆ 2    │
        └───────────┴──────┘
        >>> df = pl.DataFrame({"a": [[3, 2, 1], [1], [2]]})
        >>> df.select(pl.col("a").list.item())
        Traceback (most recent call last):
        ...
        polars.exceptions.ComputeError: aggregation 'item' expected a single value, got 3 values
        ...
        >>> df = pl.DataFrame({"a": [[], [1], [2]]})
        >>> df.select(pl.col("a").list.item(allow_empty=True))
        shape: (3, 1)
        ┌──────┐
        │ a    │
        │ ---  │
        │ i64  │
        ╞══════╡
        │ null │
        │ 1    │
        │ 2    │
        └──────┘
        r›   )r0   r1   r2   r&   )r"   rœ   s     r#   r&   zExprListNameSpace.item  s.   € ðf �xŠx�œ	™œ×(Ò(°[Ð(ÑAÔAÑBÔBÐBr%   )Únulls_equalr   rž   c               ót   — t          |d¬¦  «        }t          | j                             ||¦  «        ¦  «        S )u]  
        Check if sub-lists contain the given item.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        item
            Item that will be checked for membership
        nulls_equal : bool, default True
            If True, treat null as a distinct value. Null values will not propagate.

        Returns
        -------
        Expr
            Expression of data type :class:`Boolean`.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[3, 2, 1], [], [1, 2]]})
        >>> df.with_columns(contains=pl.col("a").list.contains(1))
        shape: (3, 2)
        ┌───────────┬──────────┐
        │ a         ┆ contains │
        │ ---       ┆ ---      │
        │ list[i64] ┆ bool     │
        ╞═══════════╪══════════╡
        │ [3, 2, 1] ┆ true     │
        │ []        ┆ false    │
        │ [1, 2]    ┆ true     │
        └───────────┴──────────┘
        T©Ú
str_as_lit)r   r   r    Úlist_contains)r"   r&   rž   Úitem_pyexprs       r#   ÚcontainszExprListNameSpace.containsF  s7   € õB ,¨D¸TÐBÑBÔBˆÝ˜œ×3Ò3°KÀÑMÔMÑNÔNÐNr%   Ú	separatorr   c               ót   — t          |d¬¦  «        }t          | j                             ||¦  «        ¦  «        S )ut  
        Join all string items in a sub-list and place a separator between them.

        This errors if inner type of list `!= String`.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        separator
            string to separate the items with
        ignore_nulls
            Ignore null values (default).

            If set to ``False``, null values will be propagated.
            If the sub-list contains any null values, the output is ``None``.

        Returns
        -------
        Expr
            Expression of data type :class:`String`.

        Examples
        --------
        >>> df = pl.DataFrame({"s": [["a", "b", "c"], ["x", "y"]]})
        >>> df.with_columns(join=pl.col("s").list.join(" "))
        shape: (2, 2)
        ┌─────────────────┬───────┐
        │ s               ┆ join  │
        │ ---             ┆ ---   │
        │ list[str]       ┆ str   │
        ╞═════════════════╪═══════╡
        │ ["a", "b", "c"] ┆ a b c │
        │ ["x", "y"]      ┆ x y   │
        └─────────────────┴───────┘

        >>> df = pl.DataFrame(
        ...     {"s": [["a", "b", "c"], ["x", "y"]], "separator": ["*", "_"]}
        ... )
        >>> df.with_columns(join=pl.col("s").list.join(pl.col("separator")))
        shape: (2, 3)
        ┌─────────────────┬───────────┬───────┐
        │ s               ┆ separator ┆ join  │
        │ ---             ┆ ---       ┆ ---   │
        │ list[str]       ┆ str       ┆ str   │
        ╞═════════════════╪═══════════╪═══════╡
        │ ["a", "b", "c"] ┆ *         ┆ a*b*c │
        │ ["x", "y"]      ┆ _         ┆ x_y   │
        └─────────────────┴───────────┴───────┘
        Tr    )r   r   r    Ú	list_join)r"   r¥   r-   Úseparator_pyexprs       r#   ÚjoinzExprListNameSpace.joinj  s9   € õf 1°ÀtÐLÑLÔLÐÝ˜œ×/Ò/Ð0@À,ÑOÔOÑPÔPÐPr%   c                óN   — t          | j                             ¦   «         ¦  «        S )u®  
        Retrieve an index of a minimal value in every sublist.

        When multiple values are equal to the minimum, this function may arbitrarily
        return the index of any of the minimum values. In this case, the returned index
        is not guaranteed to be the same across multiple runs.

        .. engine-support:: in-memory, streaming, distributed

        Returns
        -------
        Expr
            Expression of data type :class:`UInt32` or :class:`UInt64`
            (depending on compilation).

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 2], [2, 1]],
        ...     }
        ... )
        >>> df.with_columns(arg_min=pl.col("a").list.arg_min())
        shape: (2, 2)
        ┌───────────┬─────────┐
        │ a         ┆ arg_min │
        │ ---       ┆ ---     │
        │ list[i64] ┆ u32     │
        ╞═══════════╪═════════╡
        │ [1, 2]    ┆ 0       │
        │ [2, 1]    ┆ 1       │
        └───────────┴─────────┘
        )r   r    Úlist_arg_minr:   s    r#   Úarg_minzExprListNameSpace.arg_min   ó!   € õD ˜œ×2Ò2Ñ4Ô4Ñ5Ô5Ð5r%   c                óN   — t          | j                             ¦   «         ¦  «        S )u²  
        Retrieve the index of the maximum value in every sub-list.

        When multiple values are equal to the maximum, this function may arbitrarily
        return the index of any of the maximum values. In this case, the returned index
        is not guaranteed to be the same across multiple runs.

        .. engine-support:: in-memory, streaming, distributed

        Returns
        -------
        Expr
            Expression of data type :class:`UInt32` or :class:`UInt64`
            (depending on compilation).

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 2], [2, 1]],
        ...     }
        ... )
        >>> df.with_columns(arg_max=pl.col("a").list.arg_max())
        shape: (2, 2)
        ┌───────────┬─────────┐
        │ a         ┆ arg_max │
        │ ---       ┆ ---     │
        │ list[i64] ┆ u32     │
        ╞═══════════╪═════════╡
        │ [1, 2]    ┆ 1       │
        │ [2, 1]    ┆ 0       │
        └───────────┴─────────┘
        )r   r    Úlist_arg_maxr:   s    r#   Úarg_maxzExprListNameSpace.arg_maxÄ  r­   r%   ÚignoreÚnull_behaviorr   c                óR   — t          | j                             ||¦  «        ¦  «        S )u	  
        Calculate the first discrete difference between shifted items of every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        n
            Number of slots to shift.
        null_behavior : {'ignore', 'drop'}
            How to handle null values.

        Examples
        --------
        >>> df = pl.DataFrame({"n": [[1, 2, 3, 4], [10, 2, 1]]})
        >>> df.with_columns(diff=pl.col("n").list.diff())
        shape: (2, 2)
        ┌─────────────┬────────────────┐
        │ n           ┆ diff           │
        │ ---         ┆ ---            │
        │ list[i64]   ┆ list[i64]      │
        ╞═════════════╪════════════════╡
        │ [1, 2, … 4] ┆ [null, 1, … 1] │
        │ [10, 2, 1]  ┆ [null, -8, -1] │
        └─────────────┴────────────────┘

        >>> df.with_columns(diff=pl.col("n").list.diff(n=2))
        shape: (2, 2)
        ┌─────────────┬───────────────────┐
        │ n           ┆ diff              │
        │ ---         ┆ ---               │
        │ list[i64]   ┆ list[i64]         │
        ╞═════════════╪═══════════════════╡
        │ [1, 2, … 4] ┆ [null, null, … 2] │
        │ [10, 2, 1]  ┆ [null, null, -9]  │
        └─────────────┴───────────────────┘

        >>> df.with_columns(diff=pl.col("n").list.diff(n=2, null_behavior="drop"))
        shape: (2, 2)
        ┌─────────────┬───────────┐
        │ n           ┆ diff      │
        │ ---         ┆ ---       │
        │ list[i64]   ┆ list[i64] │
        ╞═════════════╪═══════════╡
        │ [1, 2, … 4] ┆ [2, 2]    │
        │ [10, 2, 1]  ┆ [-9]      │
        └─────────────┴───────────┘
        )r   r    Ú	list_diff)r"   rC   r²   s      r#   ÚdiffzExprListNameSpace.diffè  s%   € õb ˜œ×/Ò/°°=ÑAÔAÑBÔBÐBr%   c                ón   — t          |¦  «        }t          | j                             |¦  «        ¦  «        S )u¥  
        Shift every sub-lists values by the given number of indices.

        .. engine-support:: in-memory, streaming, distributed

        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]    │
        └───────────┴─────────────────┘
        )r   r   r    Ú
list_shift©r"   rC   rO   s      r#   ÚshiftzExprListNameSpace.shift  s0   € õ\ )¨Ñ+Ô+ˆÝ˜œ×0Ò0°Ñ:Ô:Ñ;Ô;Ð;r%   úint | str | ExprÚlengthúint | str | Expr | Nonec                óÒ  — t          |t          ¦  «        r;t          |t          ¦  «        s&dt          |¦  «        j        › �}t          |¦  «        ‚|�Pt          |t          ¦  «        r;t          |t          ¦  «        s&dt          |¦  «        j        › �}t          |¦  «        ‚t          |¦  «        }t          |¦  «        }t          | j         	                    ||¦  «        ¦  «        S )uô  
        Slice every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        offset
            Start index. Negative indexing is supported.
        length
            Length of the slice. If set to `None` (default), the slice is taken to the
            end of the list.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[1, 2, 3, 4], [10, 2, 1]]})
        >>> df.with_columns(slice=pl.col("a").list.slice(1, 2))
        shape: (2, 2)
        ┌─────────────┬───────────┐
        │ a           ┆ slice     │
        │ ---         ┆ ---       │
        │ list[i64]   ┆ list[i64] │
        ╞═════════════╪═══════════╡
        │ [1, 2, … 4] ┆ [2, 3]    │
        │ [10, 2, 1]  ┆ [2, 1]    │
        └─────────────┴───────────┘
        z8'offset' must be an integer, string, or expression, not Nz8'length' must be an integer, string, or expression, not )
r{   r   r}   ÚtypeÚ__name__Ú	TypeErrorr   r   r    Ú
list_slice)r"   r‘   r»   rM   r”   Úlength_pyexprs         r#   ÚslicezExprListNameSpace.sliceL  sÔ   € õ< �f�jÑ)Ô)ð 	!µ*¸VÅSÑ2IÔ2Ið 	!ØdÍTÐRXÉ\Ì\ÔMbÐdÐdˆCÝ˜C‘.”.Ð àÐÝ˜6¥:Ñ.Ô.ð å˜v¥sÑ+Ô+ð ð eÍTÐRXÉ\Ì\ÔMbÐdÐdˆCÝ˜C‘.”.Ð å-¨fÑ5Ô5ˆÝ-¨fÑ5Ô5ˆÝ˜œ×0Ò0°ÀÑNÔNÑOÔOÐOr%   é   c                ó.   — |                       d|¦  «        S )u  
        Slice the first `n` values of every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        n
            Number of values to return for each sublist.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[1, 2, 3, 4], [10, 2, 1]]})
        >>> df.with_columns(head=pl.col("a").list.head(2))
        shape: (2, 2)
        ┌─────────────┬───────────┐
        │ a           ┆ head      │
        │ ---         ┆ ---       │
        │ list[i64]   ┆ list[i64] │
        ╞═════════════╪═══════════╡
        │ [1, 2, … 4] ┆ [1, 2]    │
        │ [10, 2, 1]  ┆ [10, 2]   │
        └─────────────┴───────────┘
        r   )rÃ   )r"   rC   s     r#   ÚheadzExprListNameSpace.heady  s   € ð2 �zŠz˜!˜QÑÔÐr%   c                ón   — t          |¦  «        }t          | j                             |¦  «        ¦  «        S )u~  
        Slice the last `n` values of every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        n
            Number of values to return for each sublist.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[1, 2, 3, 4], [10, 2, 1]]})
        >>> df.with_columns(tail=pl.col("a").list.tail(2))
        shape: (2, 2)
        ┌─────────────┬───────────┐
        │ a           ┆ tail      │
        │ ---         ┆ ---       │
        │ list[i64]   ┆ list[i64] │
        ╞═════════════╪═══════════╡
        │ [1, 2, … 4] ┆ [3, 4]    │
        │ [10, 2, 1]  ┆ [2, 1]    │
        └─────────────┴───────────┘
        )r   r   r    Ú	list_tailr¸   s      r#   ÚtailzExprListNameSpace.tail”  s/   € õ2 )¨Ñ+Ô+ˆÝ˜œ×/Ò/°Ñ9Ô9Ñ:Ô:Ð:r%   ©Úempty_as_nullÚ
keep_nullsrË   rÌ   c               óˆ   — |t           u rt          d¦  «         d}t          | j                             ||¬¦  «        ¦  «        S )uä  
        Returns a column with a separate row for every sub-list.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        empty_as_null
            Explode an empty list into a `null`.
        keep_nulls
            Explode a `null` list into a `null`.

        Returns
        -------
        Expr
            Expression with the data type of the list elements.

        See Also
        --------
        Expr.reshape: Reshape this Expr to a flat Series or a Series of Lists.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[1, 2, 3], [4, 5, 6]]})
        >>> df.select(pl.col("a").list.explode(empty_as_null=False))
        shape: (6, 1)
        ┌─────┐
        │ a   │
        │ --- │
        │ i64 │
        ╞═════╡
        │ 1   │
        │ 2   │
        │ 3   │
        │ 4   │
        │ 5   │
        │ 6   │
        └─────┘
        z’In Polars 2.0, the default behavior for `empty_as_null` will change to `False`. To keep the current behavior, explicitly set `empty_as_null=True`.TrÊ   )r   r
   r   r    Úexplode)r"   rË   rÌ   s      r#   rÎ   zExprListNameSpace.explode°  sY   € ðT �HÐ$Ð$Ý%ðUñô ð ð !ˆMåØŒL× Ò ¨}ÈÐ ÑTÔTñ
ô 
ð 	
r%   r2   c                ór   — t          |d¬¦  «        }t          | j                             |¦  «        ¦  «        S )u„  
        Count how often the value produced by `element` occurs.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        element
            An expression that produces a single value

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[0], [1], [1, 2, 3, 2], [1, 2, 1], [4, 4]]})
        >>> df.with_columns(number_of_twos=pl.col("a").list.count_matches(2))
        shape: (5, 2)
        ┌─────────────┬────────────────┐
        │ a           ┆ number_of_twos │
        │ ---         ┆ ---            │
        │ list[i64]   ┆ u32            │
        ╞═════════════╪════════════════╡
        │ [0]         ┆ 0              │
        │ [1]         ┆ 0              │
        │ [1, 2, … 2] ┆ 2              │
        │ [1, 2, 1]   ┆ 1              │
        │ [4, 4]      ┆ 0              │
        └─────────────┴────────────────┘
        Tr    )r   r   r    Úlist_count_matches)r"   r2   Úelement_pyexprs      r#   Úcount_matcheszExprListNameSpace.count_matcheså  s4   € õ8 /¨wÀ4ÐHÑHÔHˆÝ˜œ×8Ò8¸ÑHÔHÑIÔIÐIr%   Úwidthc                óP   — t          | j                             |¦  «        ¦  «        S )uF  
        Convert a List column into an Array column with the same inner data type.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        width
            Width of the resulting Array column.

        Returns
        -------
        Expr
            Expression of data type :class:`Array`.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     data={"a": [[1, 2], [3, 4]]},
        ...     schema={"a": pl.List(pl.Int8)},
        ... )
        >>> df.with_columns(array=pl.col("a").list.to_array(2))
        shape: (2, 2)
        ┌──────────┬──────────────┐
        │ a        ┆ array        │
        │ ---      ┆ ---          │
        │ list[i8] ┆ array[i8, 2] │
        ╞══════════╪══════════════╡
        │ [1, 2]   ┆ [1, 2]       │
        │ [3, 4]   ┆ [3, 4]       │
        └──────────┴──────────────┘
        )r   r    Úlist_to_array)r"   rÓ   s     r#   Úto_arrayzExprListNameSpace.to_array  s#   € õB ˜œ×3Ò3°EÑ:Ô:Ñ;Ô;Ð;r%   Ún_field_strategyú ListToStructWidthStrategy | NoneÚfieldsú+Sequence[str] | Callable[[int], str] | NoneÚupper_boundc                óf  ‡— |�t          dt          ¦  «         t          ‰t          ¦  «        s^|€d}t	          j        |¦  «        ‚t          d¦  «         ‰€d„ t          |¦  «        D ¦   «         Šnˆfd„t          |¦  «        D ¦   «         Št          | j	         
                    ‰¦  «        ¦  «        S )u)
  
        Convert the Series of type `List` to a Series of type `Struct`.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        n_field_strategy : {'first_non_null', 'max_width'}
            Deprecated and ignored.
        fields
            If the name and number of the desired fields is known in advance
            a list of field names can be given, which will be assigned by index.
            Otherwise, to dynamically assign field names, a custom function can be
            used; if neither are set, fields will be `field_0, field_1 .. field_n`.
        upper_bound
            A polars expression needs to be able to evaluate the output datatype at all
            times, so the caller must provide an upper bound of the number of struct
            fields that will be created if `fields` is not a sequence of field names.

            .. versionchanged:: 1.33.0
                The `n_field_strategy` parameter is ignored and deprecated. The `fields`
                needs to be a sequence of field names or the upper bound is regarded as
                ground truth.

        Examples
        --------
        Convert list to struct with default field name assignment:

        >>> df = pl.DataFrame({"n": [[0, 1], [0, 1, 2]]})
        >>> df.with_columns(
        ...     struct=pl.col("n").list.to_struct(upper_bound=2)
        ... )  # doctest: +SKIP
        shape: (2, 2)
        ┌───────────┬───────────┐
        │ n         ┆ struct    │
        │ ---       ┆ ---       │
        │ list[i64] ┆ struct[2] │ # <- struct with 2 fields
        ╞═══════════╪═══════════╡
        │ [0, 1]    ┆ {0,1}     │ # OK
        │ [0, 1, 2] ┆ {0,1}     │ # NOT OK - last value missing
        └───────────┴───────────┘

        Convert list to struct with field name assignment by function/index:

        >>> df = pl.DataFrame({"n": [[0, 1], [2, 3]]})
        >>> df.select(
        ...     pl.col("n").list.to_struct(fields=lambda idx: f"n{idx}", upper_bound=2)
        ... ).rows(named=True)  # doctest: +SKIP
        [{'n': {'n0': 0, 'n1': 1}}, {'n': {'n0': 2, 'n1': 3}}]

        Convert list to struct with field name assignment by index from a list of names:

        >>> df.select(pl.col("n").list.to_struct(fields=["one", "two"])).rows(
        ...     named=True
        ... )
        [{'n': {'one': 0, 'two': 1}}, {'n': {'one': 2, 'two': 3}}]
        Nz[`Expr.list.to_struct` with `n_field_strategy` is deprecated and has no effect on execution.z˜`Expr.list.to_struct` requires either `fields` to be a sequence or `upper_bound` to be set.

This used to be allowed but produced unpredictable results.z`list.to_struct() without a list of field names is deprecated. Please pass a list of field names.c                ó   — g | ]}d |› �‘ŒS )Úfield_© )Ú.0Úis     r#   ú
<listcomp>z/ExprListNameSpace.to_struct.<locals>.<listcomp>w  s   € ÐCÐCÐC¨1˜, 1˜,˜,ÐCÐCÐCr%   c                ó&   •— g | ]} ‰|¦  «        ‘ŒS rß   rß   )rà   rá   rÙ   s     €r#   râ   z/ExprListNameSpace.to_struct.<locals>.<listcomp>y  s!   ø€ Ð@Ð@Ð@¨˜&˜& ™)œ)Ð@Ð@Ð@r%   )r   ÚDeprecationWarningr{   r   r   ÚInvalidOperationErrorr
   Úranger   r    Úlist_to_struct)r"   r×   rÙ   rÛ   rM   s     `  r#   Ú	to_structzExprListNameSpace.to_struct'  sÒ   ø€ ð~ Ð'ÝØmÝ"ñô ð õ
 ˜&¥(Ñ+Ô+ð 	AØÐ"ð s�Ý Ô6°sÑ;Ô;Ð;å%ð.ñô ð ð
 ˆ~ØCÐCµ°kÑ0BÔ0BÐCÑCÔC��à@Ð@Ð@Ð@­U°;Ñ-?Ô-?Ð@Ñ@Ô@�å˜œ×4Ò4°VÑ<Ô<Ñ=Ô=Ð=r%   )Úparallelré   c               ó\   — t          | j                             |j        |¦  «        ¦  «        S )uâ  
        Run any polars expression against every lists' elements.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        expr
            Expression to run. Note that you can select an element with `pl.element()`.
        parallel
            Run all expression parallel. Don't activate this blindly.
            Parallelism is worth it if there is enough work to do per thread.

            This likely should not be used in the group by context, because we already
            parallel execution per group

        Examples
        --------
        >>> df = pl.DataFrame({"a": [1, 8, 3], "b": [4, 5, 2]})
        >>> df.with_columns(
        ...     rank=pl.concat_list("a", "b").list.eval(pl.element().rank())
        ... )
        shape: (3, 3)
        ┌─────┬─────┬────────────┐
        │ a   ┆ b   ┆ rank       │
        │ --- ┆ --- ┆ ---        │
        │ i64 ┆ i64 ┆ list[f64]  │
        ╞═════╪═════╪════════════╡
        │ 1   ┆ 4   ┆ [1.0, 2.0] │
        │ 8   ┆ 5   ┆ [2.0, 1.0] │
        │ 3   ┆ 2   ┆ [2.0, 1.0] │
        └─────┴─────┴────────────┘

        See Also
        --------
        polars.Expr.list.agg: Evaluate any expression and automatically explode.
        polars.Expr.arr.eval: Same for the Array datatype.
        )r   r    Ú	list_eval)r"   r   ré   s      r#   rp   zExprListNameSpace.eval}  s'   € õN ˜œ×/Ò/°´¸hÑGÔGÑHÔHÐHr%   c                óZ   — t          | j                             |j        ¦  «        ¦  «        S )uT  
        Run any polars aggregation expression against the lists' elements.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        expr
            Expression to run. Note that you can select an element with `pl.element()`.

        Examples
        --------
        >>> df = pl.DataFrame({"a": [[1, None], [42, 13], [None, None]]})
        >>> df.with_columns(null_count=pl.col.a.list.agg(pl.element().null_count()))
        shape: (3, 2)
        ┌──────────────┬────────────┐
        │ a            ┆ null_count │
        │ ---          ┆ ---        │
        │ list[i64]    ┆ u32        │
        ╞══════════════╪════════════╡
        │ [1, null]    ┆ 1          │
        │ [42, 13]     ┆ 0          │
        │ [null, null] ┆ 2          │
        └──────────────┴────────────┘
        >>> df.with_columns(no_nulls=pl.col.a.list.agg(pl.element().drop_nulls()))
        shape: (3, 2)
        ┌──────────────┬───────────┐
        │ a            ┆ no_nulls  │
        │ ---          ┆ ---       │
        │ list[i64]    ┆ list[i64] │
        ╞══════════════╪═══════════╡
        │ [1, null]    ┆ [1]       │
        │ [42, 13]     ┆ [42, 13]  │
        │ [null, null] ┆ []        │
        └──────────────┴───────────┘

        See Also
        --------
        polars.Expr.list.eval: Evaluates expressions without automatically exploding.
        polars.Expr.arr.agg: Same for the Array datatype.
        )r   r    Úlist_aggr!   s     r#   r0   zExprListNameSpace.agg¦  s%   € õT ˜œ×.Ò.¨t¬|Ñ<Ô<Ñ=Ô=Ð=r%   Ú	predicatec                óZ   — t          | j                             |j        ¦  «        ¦  «        S )uX  
        Filter elements in each list by a boolean expression.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        predicate
            A boolean expression that is evaluated per list element.
            You can refer to the current element with `pl.element()`.

        Examples
        --------
        >>> import polars as pl
        >>> df = pl.DataFrame({"a": [1, 8, 3], "b": [4, 5, 2]})
        >>> df.with_columns(
        ...     evens=pl.concat_list("a", "b").list.filter(pl.element() % 2 == 0)
        ... )
        shape: (3, 3)
        ┌─────┬─────┬───────────┐
        │ a   ┆ b   ┆ evens     │
        │ --- ┆ --- ┆ ---       │
        │ i64 ┆ i64 ┆ list[i64] │
        ╞═════╪═════╪═══════════╡
        │ 1   ┆ 4   ┆ [4]       │
        │ 8   ┆ 5   ┆ [8]       │
        │ 3   ┆ 2   ┆ [2]       │
        └─────┴─────┴───────────┘
        )r   r    Úlist_filter)r"   rî   s     r#   ÚfilterzExprListNameSpace.filterÒ  s%   € õ< ˜œ×1Ò1°)Ô2CÑDÔDÑEÔEÐEr%   úIntoExpr | Collection[Any]c                ón  — t          |t          ¦  «        rjt          |t          ¦  «        sUt          |t          t          j        t          j        f¦  «        st          |¦  «        }t          j	        |¦  «        j
        }nt          |¦  «        }t          | j
                             |d¦  «        ¦  «        S )uå  
        Compute the SET UNION between the elements in this list and the elements of `other`.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        other
            Right hand side of the set operation.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 2, 3], [], [None, 3], [5, 6, 7]],
        ...         "b": [[2, 3, 4], [3], [3, 4, None], [6, 8]],
        ...     }
        ... )
        >>> df.with_columns(
        ...     union=pl.col("a").list.set_union("b")
        ... )  # doctest: +IGNORE_RESULT
        shape: (4, 3)
        ┌───────────┬──────────────┬───────────────┐
        │ a         ┆ b            ┆ union         │
        │ ---       ┆ ---          ┆ ---           │
        │ list[i64] ┆ list[i64]    ┆ list[i64]     │
        ╞═══════════╪══════════════╪═══════════════╡
        │ [1, 2, 3] ┆ [2, 3, 4]    ┆ [1, 2, 3, 4]  │
        │ []        ┆ [3]          ┆ [3]           │
        │ [null, 3] ┆ [3, 4, null] ┆ [null, 3, 4]  │
        │ [5, 6, 7] ┆ [6, 8]       ┆ [5, 6, 7, 8]  │
        └───────────┴──────────────┴───────────────┘
        Úunion©r{   r   r}   r   r|   r   Ú	DataFramer   r1   Úlitr    r   r   Úlist_set_operation©r"   rx   Úother_pyexprs      r#   Ú	set_unionzExprListNameSpace.set_unionò  s�   € õD �e�ZÑ(Ô(ð 	8µ¸EÅ3Ñ1GÔ1Gð 	8Ý˜e¥hµ´	½2¼<Ð%HÑIÔIð $Ý˜U™œ�Ýœ5 ™<œ<Ô/ˆLˆLå0°Ñ7Ô7ˆLÝ˜œ×8Ò8¸ÀwÑOÔOÑPÔPÐPr%   c                ón  — t          |t          ¦  «        rjt          |t          ¦  «        sUt          |t          t          j        t          j        f¦  «        st          |¦  «        }t          j	        |¦  «        j
        }nt          |¦  «        }t          | j
                             |d¦  «        ¦  «        S )u  
        Compute the SET DIFFERENCE between the elements in this list and the elements of `other`.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        other
            Right hand side of the set operation.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 2, 3], [], [None, 3], [5, 6, 7]],
        ...         "b": [[2, 3, 4], [3], [3, 4, None], [6, 8]],
        ...     }
        ... )
        >>> df.with_columns(difference=pl.col("a").list.set_difference("b"))
        shape: (4, 3)
        ┌───────────┬──────────────┬────────────┐
        │ a         ┆ b            ┆ difference │
        │ ---       ┆ ---          ┆ ---        │
        │ list[i64] ┆ list[i64]    ┆ list[i64]  │
        ╞═══════════╪══════════════╪════════════╡
        │ [1, 2, 3] ┆ [2, 3, 4]    ┆ [1]        │
        │ []        ┆ [3]          ┆ []         │
        │ [null, 3] ┆ [3, 4, null] ┆ []         │
        │ [5, 6, 7] ┆ [6, 8]       ┆ [5, 7]     │
        └───────────┴──────────────┴────────────┘

        See Also
        --------
        polars.Expr.list.diff: Calculates the n-th discrete difference of every sublist.
        Ú
differencerõ   rù   s      r#   Úset_differencez ExprListNameSpace.set_difference  s�   € õH �e�ZÑ(Ô(ð 	8µ¸EÅ3Ñ1GÔ1Gð 	8Ý˜e¥hµ´	½2¼<Ð%HÑIÔIð $Ý˜U™œ�Ýœ5 ™<œ<Ô/ˆLˆLå0°Ñ7Ô7ˆLÝ˜œ×8Ò8¸À|ÑTÔTÑUÔUÐUr%   c                ón  — t          |t          ¦  «        rjt          |t          ¦  «        sUt          |t          t          j        t          j        f¦  «        st          |¦  «        }t          j	        |¦  «        j
        }nt          |¦  «        }t          | j
                             |d¦  «        ¦  «        S )u±  
        Compute the SET INTERSECTION between the elements in this list and the elements of `other`.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        other
            Right hand side of the set operation.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 2, 3], [], [None, 3], [5, 6, 7]],
        ...         "b": [[2, 3, 4], [3], [3, 4, None], [6, 8]],
        ...     }
        ... )
        >>> df.with_columns(intersection=pl.col("a").list.set_intersection("b"))
        shape: (4, 3)
        ┌───────────┬──────────────┬──────────────┐
        │ a         ┆ b            ┆ intersection │
        │ ---       ┆ ---          ┆ ---          │
        │ list[i64] ┆ list[i64]    ┆ list[i64]    │
        ╞═══════════╪══════════════╪══════════════╡
        │ [1, 2, 3] ┆ [2, 3, 4]    ┆ [2, 3]       │
        │ []        ┆ [3]          ┆ []           │
        │ [null, 3] ┆ [3, 4, null] ┆ [null, 3]    │
        │ [5, 6, 7] ┆ [6, 8]       ┆ [6]          │
        └───────────┴──────────────┴──────────────┘
        Úintersectionrõ   rù   s      r#   Úset_intersectionz"ExprListNameSpace.set_intersectionH  s�   € õ@ �e�ZÑ(Ô(ð 	8µ¸EÅ3Ñ1GÔ1Gð 	8Ý˜e¥hµ´	½2¼<Ð%HÑIÔIð $Ý˜U™œ�Ýœ5 ™<œ<Ô/ˆLˆLå0°Ñ7Ô7ˆLÝ˜œ×8Ò8¸À~ÑVÔVÑWÔWÐWr%   c                ón  — t          |t          ¦  «        rjt          |t          ¦  «        sUt          |t          t          j        t          j        f¦  «        st          |¦  «        }t          j	        |¦  «        j
        }nt          |¦  «        }t          | j
                             |d¦  «        ¦  «        S )uŠ  
        Compute the SET SYMMETRIC DIFFERENCE between the elements in this list and the elements of `other`.

        .. engine-support:: in-memory, streaming, distributed

        Parameters
        ----------
        other
            Right hand side of the set operation.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "a": [[1, 2, 3], [], [None, 3], [5, 6, 7]],
        ...         "b": [[2, 3, 4], [3], [3, 4, None], [6, 8]],
        ...     }
        ... )
        >>> df.with_columns(sdiff=pl.col("b").list.set_symmetric_difference("a"))
        shape: (4, 3)
        ┌───────────┬──────────────┬───────────┐
        │ a         ┆ b            ┆ sdiff     │
        │ ---       ┆ ---          ┆ ---       │
        │ list[i64] ┆ list[i64]    ┆ list[i64] │
        ╞═══════════╪══════════════╪═══════════╡
        │ [1, 2, 3] ┆ [2, 3, 4]    ┆ [4, 1]    │
        │ []        ┆ [3]          ┆ [3]       │
        │ [null, 3] ┆ [3, 4, null] ┆ [4]       │
        │ [5, 6, 7] ┆ [6, 8]       ┆ [8, 5, 7] │
        └───────────┴──────────────┴───────────┘
        Úsymmetric_differencerõ   rù   s      r#   Úset_symmetric_differencez*ExprListNameSpace.set_symmetric_differencep  s—   € õ@ �e�ZÑ(Ô(ð 	8µ¸EÅ3Ñ1GÔ1Gð 	8Ý˜e¥hµ´	½2¼<Ð%HÑIÔIð $Ý˜U™œ�Ýœ5 ™<œ<Ô/ˆLˆLå0°Ñ7Ô7ˆLÝØŒL×+Ò+¨LÐ:PÑQÔQñ
ô 
ð 	
r%   )r   r   r   r   )r&   r'   r   r   )r-   r.   r   r   )r   r   r   )rC   rD   r?   rE   r@   r.   rA   rF   rB   rG   r   r   )rI   )ra   r'   r   r   )rj   r.   rk   r.   r   r   )rs   r.   r   r   )rx   ry   r   r   )r…   r†   r„   r.   r   r   )rŠ   r‹   r„   r.   r   r   )r   )rC   r�   r‘   r�   r   r   )rœ   r.   r   r   )r&   r   rž   r.   r   r   )r¥   r   r-   r.   r   r   )rI   r±   )rC   r'   r²   r   r   r   )rC   r�   r   r   )r‘   rº   r»   r¼   r   r   )rÄ   )rC   rº   r   r   )rË   r.   rÌ   r.   r   r   )r2   r   r   r   )rÓ   r'   r   r   )NNN)r×   rØ   rÙ   rÚ   rÛ   rG   r   r   )r   r   ré   r.   r   r   )r   r   r   r   )rî   r   r   r   )rx   rò   r   r   )4r¿   Ú
__module__Ú__qualname__Ú__doc__Ú	_accessorr$   r+   r3   r7   r;   r>   rP   rS   rV   rZ   r]   r`   re   ri   rn   rq   ru   rw   r~   r*   r�   r•   r—   rš   r   r&   r¤   r©   r¬   r°   rµ   r¹   rÃ   rÆ   rÉ   r   rÎ   rÒ   rÖ   rè   rp   r0   rñ   rû   rþ   r  r  rß   r%   r#   r   r      sJ  € € € € € Ø1Ð1à€Ið$ð $ð $ð $ðð ð ð ð< +/ð %Dð %Dð %Dð %Dð %Dð %DðN +/ð %Dð %Dð %Dð %Dð %Dð %DðN2ð 2ð 2ð 2ð:9ð 9ð 9ð 9ð6 *.ðE
ð 37Ø!&Ø#ØðE
ð E
ð E
ð E
ð E
ð E
ðN2ð 2ð 2ð 2ð42ð 2ð 2ð 2ð,2ð 2ð 2ð 2ð,3ð 3ð 3ð 3ð,5ð 5ð 5ð 5ð,6ð 6ð 6ð 6ð 6ð:6ð 6ð 6ð 6ð 6ð: */À5ð )Ið )Ið )Ið )Ið )Ið )IðV0ð 0ð 0ð 0ð4 05ð Lð Lð Lð Lð Lð Lð<0ð 0ð 0ð 0ð4')ð ')ð ')ð ')ðZ "ð	)Kð )Kð )Kð )Kð )Kð )Kð^ "ð	(Pð (Pð (Pð (Pð (Pð (PðZ ()ð,Rð ,Rð ,Rð ,Rð ,Rð\-ð -ð -ð -ð..ð .ð .ð .ð. €X�Z„ZØ*/ð 2Cð 2Cð 2Cð 2Cð 2Cñ „Zð2Cðh ?Cð "Oð "Oð "Oð "Oð "Oð "OðH GKð 4Qð 4Qð 4Qð 4Qð 4Qð 4Qðl"6ð "6ð "6ð "6ðH"6ð "6ð "6ð "6ðH1Cð 1Cð 1Cð 1Cð 1Cðf/<ð /<ð /<ð /<ð /<ðd KOð+Pð +Pð +Pð +Pð +PðZ ð  ð  ð  ð  ð6;ð ;ð ;ð ;ð ;ð: (0ÀDð3
ð 3
ð 3
ð 3
ð 3
ð 3
ðjJð Jð Jð Jð>!<ð !<ð !<ð !<ðJ >BØ>BØ"&ð	T>ð T>ð T>ð T>ð T>ðl 49ð 'Ið 'Ið 'Ið 'Ið 'Ið 'IðR*>ð *>ð *>ð *>ðXFð Fð Fð Fð@(Qð (Qð (Qð (QðT*Vð *Vð *Vð *VðX&Xð &Xð &Xð &XðP(
ð (
ð (
ð (
ð (
ð (
r%   r   )&Ú
__future__r   r   Úcollections.abcr   r   Útypingr   r   Úpolars._reexportÚ	_reexportr|   Úpolarsr   r	   r1   Úpolars._utils.deprecationr
   Úpolars._utils.parser   Úpolars._utils.unstabler   Úpolars._utils.variousr   r   Úpolars._utils.wrapr   Úpolars._warningsr   r   r   r   Úpolars._typingr   r   r   r   r   rß   r%   r#   ú<module>r     s¥  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø +Ð +Ð +Ð +Ð +Ð +Ø BÐ BÐ BÐ BÐ BÐ BÐ BÐ BØ (Ð (Ð (Ð (Ð (Ð (Ø *Ð *Ð *Ð *Ð *Ð *àð 	Ø(Ð(Ð(Ð(Ð(Ð(à#Ð#Ð#Ð#Ð#Ð#Ð#Ð#ðð ð ð ð ð ð ð ð ð ð ð ð{
ð {
ð {
ð {
ð {
Ð.ñ {
ô {
ð {
ð {
ð {
r%   