§
    q-Phō ć                  óŗ   d dl mZ d dlZd dlmZ d dlmZmZmZm	Z	 d dl
mZ d dlmZ d dlmZmZ d dlmZmZmZmZ d dlmZmZ d dlmZmZ d d	lmZm Z  d d
l!m"Z"m#Z# d dl$m%Z%m&Z&m'Z'm(Z( d dl)m*Z*m+Z+  ej,        e-¦  «        5  d dl.m/Z0 ddd¦  «         n# 1 swxY w Y   erNd dl1Z1d dlm2Z2m3Z3m4Z4 d dlm5Z5 d dl/m6Z6m7Z7m8Z8m9Z9 d dl:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@ d dl)mAZA e1jB        dk    rd dlCmZ nd dlDmZ dĘdZEdĒdZFdČdZGdddÉd!ZHdČd"ZIdŹdĖd'ZJdŹdĖd(ZKdČd)ZLdČd*ZMdČd+ZNdČd,ZOdČd-ZPdČd.ZQdĢd1ZRdĶdĪd4ZSdĶdĪd5ZTe	d6d6d6d6d7dĻdA¦   «         ZUe	d6d6d6dBdŠdE¦   «         ZUdFdddd7dŃdHZUe	d6d6dIdŅdJ¦   «         ZVe	d6dKdÓdL¦   «         ZVd#ddIdŌdMZV	 dÕdÖdTZW	 dÕddUd×dYZXdddZdŲd^ZYdŁd_ZZdd`dŚdbZ[dŁdcZ\dŪdgZ] edh¦  «        dŪdi¦   «         Z^dÜdmZ_dŻdnZ`	 dŽdßdtZaddduddvdąd~Zb e¦   «          e+¦   «         dududududdududududue*dddįd¦   «         ¦   «         Zce	de*ddād¦   «         Zde	dde*ddćd¦   «         Zd e¦   «          e¦   «         dde*ddäd¦   «         ¦   «         Zd e¦   «         e*ddåd¦   «         Zee	d6ddęd”¦   «         Zfe	dēd£¦   «         Zfduddčd„Zfe	d6ddéd§¦   «         Zge	dźdØ¦   «         Zgdddėd©Zge	d6ddģdŖ¦   «         Zhe	dķd«¦   «         Zhe	dīd¬¦   «         Zhdddīd­Zhe	dļdšd°¦   «         Zie		 dļdńd²¦   «         Zi	 dņdódµZi ed¶d·dø¬¹¦  «        dd#dŗdōd¼¦   «         Zj ed¶d·dø¬¹¦  «        dd#dŗdōd½¦   «         Zke	dõdæ¦   «         Zle	dödĀ¦   «         Zld÷dÅZldS )ųé    )ŚannotationsN)ŚSequence)ŚTYPE_CHECKINGŚAnyŚCallableŚoverload)Ś_AioDataFrameResultŚ_GeventDataFrameResult)Śdeprecate_renamed_parameterŚdeprecate_streaming_parameterŚ
deprecatedŚissue_deprecation_warning)Śparse_into_expressionŚparse_into_list_of_expressions)Śissue_unstable_warningŚunstable)Śextend_boolŚqualified_type_name)Śwrap_dfŚ	wrap_expr)ŚDTYPE_TEMPORAL_UNITSŚDateŚDatetimeŚInt64)ŚDEFAULT_QUERY_OPT_FLAGSŚforward_old_opt_flags)Ś	AwaitableŚ
CollectionŚIterable)ŚLiteral)Ś	DataFrameŚExprŚ	LazyFrameŚSeries)ŚCorrelationMethodŚ
EngineTypeŚEpochTimeUnitŚIntoExprŚPolarsDataTypeŚQuantileMethod)ŚQueryOptFlags)é   é   )r   Śnameśstr | list[str]Śreturnr"   c                ót    t          | t          ¦  «        r| g} t          t          j        | ¦  «        ¦  «        S )zu
    Select a field in the current `struct.with_fields` scope.

    name
        Name of the field(s) to select.
    )Ś
isinstanceŚstrr   ŚplrŚfield)r.   s    śU/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/polars/functions/lazy.pyr5   r5   8   s3    õ $ŃŌš ŲvŻSYt__Ń%Ō%Š%ó    c                 ó*    t          j        d¦  «        S )u©	  
    Alias for an element being evaluated in an `eval` or `filter` expression.

    Examples
    --------
    A horizontal rank computation by taking the elements of a list

    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...     }
    ... )
    >>> df.with_columns(
    ...     pl.concat_list(["a", "b"]).list.eval(pl.element().rank()).alias("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] ā
    āāāāāāā“āāāāāā“āāāāāāāāāāāāā

    A mathematical operation on array elements

    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...     }
    ... )
    >>> df.with_columns(
    ...     pl.concat_list(["a", "b"]).list.eval(pl.element() * 2).alias("a_b_doubled")
    ... )
    shape: (3, 3)
    āāāāāāā¬āāāāāā¬āāāāāāāāāāāāāā
    ā a   ā b   ā a_b_doubled ā
    ā --- ā --- ā ---         ā
    ā i64 ā i64 ā list[i64]   ā
    āāāāāāāŖāāāāāāŖāāāāāāāāāāāāāā”
    ā 1   ā 4   ā [2, 8]      ā
    ā 8   ā 5   ā [16, 10]    ā
    ā 3   ā 2   ā [6, 4]      ā
    āāāāāāā“āāāāāā“āāāāāāāāāāāāāā

    A filter operation on list elements

    >>> 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]       ā
    āāāāāāā“āāāāāā“āāāāāāāāāāāā
    Ś )ŚFŚcol© r7   r6   Śelementr=   D   s    õH 599Šr7   Ścolumnsr3   c                 ó“    | s7t          dd¬¦  «         t          j        ¦   «                              d¦  «        S t          j        |                       ¦   «         S )u\  
    Return the number of non-null values in the column.

    This function is syntactic sugar for `col(columns).count()`.

    Calling this function without any arguments returns the number of rows in the
    context. **This way of using the function is deprecated.** Please use :func:`len`
    instead.

    Parameters
    ----------
    *columns
        One or more column names.

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

    See Also
    --------
    Expr.count

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, None],
    ...         "b": [3, None, None],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.count("a"))
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā u32 ā
    āāāāāāā”
    ā 2   ā
    āāāāāāā

    Return the number of non-null values in multiple columns.

    >>> df.select(pl.count("b", "c"))
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā b   ā c   ā
    ā --- ā --- ā
    ā u32 ā u32 ā
    āāāāāāāŖāāāāāā”
    ā 1   ā 3   ā
    āāāāāāā“āāāāāā

    Return the number of rows in a context. **This way of using the function is
    deprecated.** Please use :func:`len` instead.

    >>> df.select(pl.count())  # doctest: +SKIP
    shape: (1, 1)
    āāāāāāāāā
    ā count ā
    ā ---   ā
    ā u32   ā
    āāāāāāāāā”
    ā 3     ā
    āāāāāāāāā
    z:`pl.count()` is deprecated. Please use `pl.len()` instead.z0.20.5©ŚversionŚcount)r   r:   ŚlenŚaliasr;   rB   ©r>   s    r6   rB   rB      s\    šH š &Ż!ŲHŲš	
ń 	
ō 	
š 	
õ uww}}WŃ%Ō%Š%Ż5'?× Ņ Ń"Ō"Š"r7   F©ŚreverserG   Śboolc                óF    t          j        |                      | ¬¦  «        S )uT  
    Return the cumulative count of the non-null values in the column.

    This function is syntactic sugar for `col(columns).cum_count()`.

    Parameters
    ----------
    *columns
        Name(s) of the columns to use.
    reverse
        Reverse the operation.

    Examples
    --------
    >>> df = pl.DataFrame({"a": [1, 2, None], "b": [3, None, None]})
    >>> df.select(pl.cum_count("a"))
    shape: (3, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā u32 ā
    āāāāāāā”
    ā 1   ā
    ā 2   ā
    ā 2   ā
    āāāāāāā
    rF   )r:   r;   Ś	cum_count)rG   r>   s     r6   rJ   rJ   Ų   s!    õ8 5'?×$Ņ$ØWŠ$Ń5Ō5Š5r7   c                 óB    t          j        |                       ¦   «         S )uō  
    Aggregate all column values into a list.

    This function is syntactic sugar for `pl.col(name).implode()`.

    Parameters
    ----------
    *columns
        One or more column names.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, 3],
    ...         "b": [9, 8, 7],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.implode("a"))
    shape: (1, 1)
    āāāāāāāāāāāāā
    ā a         ā
    ā ---       ā
    ā list[i64] ā
    āāāāāāāāāāāāā”
    ā [1, 2, 3] ā
    āāāāāāāāāāāāā
    >>> df.select(pl.implode("b", "c"))
    shape: (1, 2)
    āāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāā
    ā b         ā c                     ā
    ā ---       ā ---                   ā
    ā list[i64] ā list[str]             ā
    āāāāāāāāāāāāāŖāāāāāāāāāāāāāāāāāāāāāāāā”
    ā [9, 8, 7] ā ["foo", "bar", "foo"] ā
    āāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāāāāāāā

    )r:   r;   ŚimploderE   s    r6   rL   rL   ÷   s    õP 5'?×"Ņ"Ń$Ō$Š$r7   é   ŚcolumnŚddofŚintc                óP    t          j        | ¦  «                             |¦  «        S )uQ  
    Get the standard deviation.

    This function is syntactic sugar for `pl.col(column).std(ddof)`.

    Parameters
    ----------
    column
        Column name.
    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(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.std("a"))
    shape: (1, 1)
    āāāāāāāāāāāā
    ā a        ā
    ā ---      ā
    ā f64      ā
    āāāāāāāāāāāā”
    ā 3.605551 ā
    āāāāāāāāāāāā
    >>> df["a"].std()
    3.605551275463989
    )r:   r;   Śstd©rN   rO   s     r6   rR   rR   "  ó!    õH 5==×ŅTŃ"Ō"Š"r7   c                óP    t          j        | ¦  «                             |¦  «        S )u  
    Get the variance.

    This function is syntactic sugar for `pl.col(column).var(ddof)`.

    Parameters
    ----------
    column
        Column name.
    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(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     },
    ... )
    >>> df.select(pl.var("a"))
    shape: (1, 1)
    āāāāāāāā
    ā a    ā
    ā ---  ā
    ā f64  ā
    āāāāāāāā”
    ā 13.0 ā
    āāāāāāāā
    >>> df["a"].var()
    13.0
    )r:   r;   ŚvarrS   s     r6   rV   rV   I  rT   r7   c                 óB    t          j        |                       ¦   «         S )uĆ  
    Get the mean value.

    This function is syntactic sugar for `pl.col(columns).mean()`.

    Parameters
    ----------
    *columns
        One or more column names.

    See Also
    --------
    mean_horizontal

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.mean("a"))
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā f64 ā
    āāāāāāā”
    ā 4.0 ā
    āāāāāāā
    >>> df.select(pl.mean("a", "b"))
    shape: (1, 2)
    āāāāāāā¬āāāāāāāāāāā
    ā a   ā b        ā
    ā --- ā ---      ā
    ā f64 ā f64      ā
    āāāāāāāŖāāāāāāāāāāā”
    ā 4.0 ā 3.666667 ā
    āāāāāāā“āāāāāāāāāāā

    )r:   r;   ŚmeanrE   s    r6   rX   rX   p  s    õX 5'?×ŅŃ!Ō!Š!r7   c                 óB    t          j        |                       ¦   «         S )uZ  
    Get the median value.

    This function is syntactic sugar for `pl.col(columns).median()`.

    Parameters
    ----------
    columns
        One or more column names.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.median("a"))
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā f64 ā
    āāāāāāā”
    ā 3.0 ā
    āāāāāāā
    >>> df.select(pl.median("a", "b"))
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā a   ā b   ā
    ā --- ā --- ā
    ā f64 ā f64 ā
    āāāāāāāŖāāāāāā”
    ā 3.0 ā 4.0 ā
    āāāāāāā“āāāāāā

    )r:   r;   ŚmedianrE   s    r6   rZ   rZ     s    õP 5'?×!Ņ!Ń#Ō#Š#r7   c                 óB    t          j        |                       ¦   «         S )u_  
    Count unique values.

    This function is syntactic sugar for `pl.col(columns).n_unique()`.

    Parameters
    ----------
    columns
        One or more column names.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 1],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.n_unique("a"))
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā u32 ā
    āāāāāāā”
    ā 2   ā
    āāāāāāā
    >>> df.select(pl.n_unique("b", "c"))
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā b   ā c   ā
    ā --- ā --- ā
    ā u32 ā u32 ā
    āāāāāāāŖāāāāāā”
    ā 3   ā 2   ā
    āāāāāāā“āāāāāā

    )r:   r;   Śn_uniquerE   s    r6   r\   r\   Ź  s    õP 5'?×#Ņ#Ń%Ō%Š%r7   c                 óB    t          j        |                       ¦   «         S )uČ  
    Approximate count of unique values.

    This function is syntactic sugar for `pl.col(columns).approx_n_unique()`, and
    uses the HyperLogLog++ algorithm for cardinality estimation.

    Parameters
    ----------
    columns
        One or more column names.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 1],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.approx_n_unique("a"))
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā u32 ā
    āāāāāāā”
    ā 2   ā
    āāāāāāā
    >>> df.select(pl.approx_n_unique("b", "c"))
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā b   ā c   ā
    ā --- ā --- ā
    ā u32 ā u32 ā
    āāāāāāāŖāāāāāā”
    ā 3   ā 2   ā
    āāāāāāā“āāāāāā

    )r:   r;   Śapprox_n_uniquerE   s    r6   r^   r^   õ  s    õR 5'?×*Ņ*Ń,Ō,Š,r7   c                 ó    | s t          t          j        ¦   «         ¦  «        S t          j        |                       ¦   «         S )uH  
    Get the first column or value.

    This function has different behavior depending on the presence of `columns`
    values. If none given (the default), returns an expression that takes the first
    column of the context; otherwise, takes the first value of the given column(s).

    Parameters
    ----------
    *columns
        One or more column names.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "baz"],
    ...     }
    ... )

    Return the first column:

    >>> df.select(pl.first())
    shape: (3, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 1   ā
    ā 8   ā
    ā 3   ā
    āāāāāāā

    Return the first value for the given column(s):

    >>> df.select(pl.first("b"))
    shape: (1, 1)
    āāāāāāā
    ā b   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 4   ā
    āāāāāāā
    >>> df.select(pl.first("a", "c"))
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā a   ā c   ā
    ā --- ā --- ā
    ā i64 ā str ā
    āāāāāāāŖāāāāāā”
    ā 1   ā foo ā
    āāāāāāā“āāāāāā

    )r   r4   Śfirstr:   r;   rE   s    r6   r`   r`   !  s9    šv š &ŻŃ%Ō%Š%å5'?× Ņ Ń"Ō"Š"r7   c                 ó    | s t          t          j        ¦   «         ¦  «        S t          j        |                       ¦   «         S )u@  
    Get the last column or value.

    This function has different behavior depending on the presence of `columns`
    values. If none given (the default), returns an expression that takes the last
    column of the context; otherwise, takes the last value of the given column(s).

    Parameters
    ----------
    *columns
        One or more column names.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "baz"],
    ...     }
    ... )

    Return the last column:

    >>> df.select(pl.last())
    shape: (3, 1)
    āāāāāāā
    ā c   ā
    ā --- ā
    ā str ā
    āāāāāāā”
    ā foo ā
    ā bar ā
    ā baz ā
    āāāāāāā

    Return the last value for the given column(s):

    >>> df.select(pl.last("a"))
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 3   ā
    āāāāāāā
    >>> df.select(pl.last("b", "c"))
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā b   ā c   ā
    ā --- ā --- ā
    ā i64 ā str ā
    āāāāāāāŖāāāāāā”
    ā 2   ā baz ā
    āāāāāāā“āāāāāā

    )r   r4   Ślastr:   r;   rE   s    r6   rb   rb   b  s9    šv š %ŻŃ$Ō$Š$å5'?×ŅŃ!Ō!Š!r7   Śindicesśint | Sequence[int]c                 ó°    t          | ¦  «        dk    r#t          | d         t          ¦  «        r| d         } t          t	          j        | ¦  «        ¦  «        S )u  
    Get the nth column(s) of the context.

    Parameters
    ----------
    indices
        One or more indices representing the columns to retrieve.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "baz"],
    ...     }
    ... )
    >>> df.select(pl.nth(1))
    shape: (3, 1)
    āāāāāāā
    ā b   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 4   ā
    ā 5   ā
    ā 2   ā
    āāāāāāā
    >>> df.select(pl.nth(2, 0))
    shape: (3, 2)
    āāāāāāā¬āāāāāā
    ā c   ā a   ā
    ā --- ā --- ā
    ā str ā i64 ā
    āāāāāāāŖāāāāāā”
    ā foo ā 1   ā
    ā bar ā 8   ā
    ā baz ā 3   ā
    āāāāāāā“āāāāāā
    rM   r   )rC   r2   r   r   r4   Ś
index_cols)rc   s    r6   Śnthrg   £  sJ    õR 7||qŅŠZØ°¬
µHŃ=Ō=ŠŲ!*åS^ GŃ,Ō,Ń-Ō-Š-r7   é
   Śnc                óP    t          j        | ¦  «                             |¦  «        S )uG  
    Get the first `n` rows.

    This function is syntactic sugar for `pl.col(column).head(n)`.

    Parameters
    ----------
    column
        Column name.
    n
        Number of rows to return.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.head("a"))
    shape: (3, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 1   ā
    ā 8   ā
    ā 3   ā
    āāāāāāā
    >>> df.select(pl.head("a", 2))
    shape: (2, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 1   ā
    ā 8   ā
    āāāāāāā
    )r:   r;   Śhead©rN   ri   s     r6   rk   rk   Ņ  ó!    õX 5==×ŅaŃ Ō Š r7   c                óP    t          j        | ¦  «                             |¦  «        S )uF  
    Get the last `n` rows.

    This function is syntactic sugar for `pl.col(column).tail(n)`.

    Parameters
    ----------
    column
        Column name.
    n
        Number of rows to return.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.tail("a"))
    shape: (3, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 1   ā
    ā 8   ā
    ā 3   ā
    āāāāāāā
    >>> df.select(pl.tail("a", 2))
    shape: (2, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 8   ā
    ā 3   ā
    āāāāāāā
    )r:   r;   Śtailrl   s     r6   ro   ro     rm   r7   .)ŚmethodrO   Śpropagate_nansŚeagerŚar(   Śbrp   r%   ś
int | Nonerq   rr   śLiteral[False]c               ó    d S ©Nr<   ©rs   rt   rp   rO   rq   rr   s         r6   Ścorrrz   0  s	    š 3r7   )rp   rO   rq   śLiteral[True]r$   c               ó    d S rx   r<   ry   s         r6   rz   rz   <  s	    š Sr7   ŚpearsonśExpr | Seriesc          	     ó~   |t          dd¬¦  «         |r¦t          | t          j        ¦  «        s+t          |t          j        ¦  «        sd}t	          |¦  «        t          j        d | |fD ¦   «         ¦  «        }d | |fD ¦   «         }|                     t          |d||d	¦  «                             ¦   «         S t          | ¦  «        } t          |¦  «        }|d
k    r"t          t          j        | |¦  «        ¦  «        S |dk    r#t          t          j        | ||¦  «        ¦  «        S d|}t	          |¦  «        )u"  
    Compute the Pearson's or Spearman rank correlation between two columns.

    Parameters
    ----------
    a
        Column name or Expression.
    b
        Column name or Expression.
    ddof
        Has no effect, do not use.

        .. deprecated:: 1.17.0

    method : {'pearson', 'spearman'}
        Correlation method.
    propagate_nans
        If `True` any `NaN` encountered will lead to `NaN` in the output.
        Defaults to `False` where `NaN` are regarded as larger than any finite number
        and thus lead to the highest rank.
    eager
        Evaluate immediately and return a `Series`; this requires that at least one
        of the given arguments is a `Series`. If set to `False` (default), return
        an expression instead.

    Examples
    --------
    Pearson's correlation:

    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.corr("a", "b"))
    shape: (1, 1)
    āāāāāāāāāāāā
    ā a        ā
    ā ---      ā
    ā f64      ā
    āāāāāāāāāāāā”
    ā 0.544705 ā
    āāāāāāāāāāāā

    Spearman rank correlation:

    >>> df.select(pl.corr("a", "b", method="spearman"))
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā f64 ā
    āāāāāāā”
    ā 0.5 ā
    āāāāāāā

    Eager evaluation:

    >>> s1 = pl.Series("a", [1, 8, 3])
    >>> s2 = pl.Series("b", [4, 5, 2])
    >>> pl.corr(s1, s2, eager=True)
    shape: (1,)
    Series: 'a' [f64]
    [
        0.544705
    ]
    >>> pl.corr(s1, s2, method="spearman", eager=True)
    shape: (1,)
    Series: 'a' [f64]
    [
        0.5
    ]
    Nz2the `ddof` parameter has no effect. Do not use it.z1.17.0r@   z=expected at least one Series in 'corr' inputs if 'eager=True'c                óF    g | ]}t          |t          j        ¦  «        Æ|S r<   ©r2   Śplr$   ©Ś.0Śes     r6   ś
<listcomp>zcorr.<locals>.<listcomp>§  ó)    ŠLŠLŠL Aµ:øaÅÄŃ3KŌ3KŠLaŠLŠLŠLr7   c              3  ó\   K   | ]'}t          |t          j        ¦  «        r|j        n|V  (d S rx   ©r2   r   r$   r.   r   s     r6   ś	<genexpr>zcorr.<locals>.<genexpr>Ø  ó9   č č  ŠMŠMĄJ q­"¬)Ń4Ō4Š;!&&ø!ŠMŠMŠMŠMŠMŠMr7   F)rr   rp   rq   r}   Śspearmanz3method must be one of {'pearson', 'spearman'}, got )r   r2   r   r$   Ś
ValueErrorr!   Śselectrz   Ś	to_seriesr   r   r4   Śpearson_corrŚspearman_rank_corr)	rs   rt   rp   rO   rq   rr   ŚmsgŚframeŚexprss	            r6   rz   rz   H  sY   šh ŠŻ!Ų@Ųš	
ń 	
ō 	
š 	
š
 š "Ż1biŃ(Ō(š 	"­J°q½"¼)Ń,DŌ,Dš 	"ŲQCŻS//Š!åŠLŠLØ!ØQØŠLŃLŌLŃMŌMŲMŠMĄqČ!ĄfŠMŃMŌMŲ||Ż%uØVĄNŠSŠSŠSń
ō 
ē
)++š	õ " !Ń$Ō$Ż! !Ń$Ō$ąYŅŠŻSŌ-Øa°Ń3Ō3Ń4Ō4Š4ŲzŅ!Š!ŻSŌ3°A°qø.ŃIŌIŃJŌJŠJąTČ&ŠTŠTCŻS//Š!r7   )rO   rr   c               ó    d S rx   r<   ©rs   rt   rO   rr   s       r6   Ścovr   ¹  s	    š 3r7   )rO   c               ó    d S rx   r<   r   s       r6   r   r   Ć  s	    š Sr7   c               óŅ   |r„t          | t          j        ¦  «        s+t          |t          j        ¦  «        sd}t          |¦  «        t          j        d | |fD ¦   «         ¦  «        }d | |fD ¦   «         }|                     t          |d|d¦  «                             ¦   «         S t          | ¦  «        } t          |¦  «        }t          t          j        | ||¦  «        ¦  «        S )u  
    Compute the covariance between two columns/ expressions.

    Parameters
    ----------
    a
        Column name or Expression.
    b
        Column name or Expression.
    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.
    eager
        Evaluate immediately and return a `Series`; this requires that at least one
        of the given arguments is a `Series`. If set to `False` (default), return
        an expression instead.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 8, 3],
    ...         "b": [4, 5, 2],
    ...         "c": ["foo", "bar", "foo"],
    ...     },
    ... )

    >>> df.select(
    ...     x=pl.cov("a", "b"),
    ...     y=pl.cov("a", "b", ddof=2),
    ... )
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā x   ā y   ā
    ā --- ā --- ā
    ā f64 ā f64 ā
    āāāāāāāŖāāāāāā”
    ā 3.0 ā 6.0 ā
    āāāāāāā“āāāāāā

    Eager evaluation:

    >>> s1 = pl.Series("a", [1, 8, 3])
    >>> s2 = pl.Series("b", [4, 5, 2])
    >>> pl.cov(s1, s2, eager=True)
    shape: (1,)
    Series: 'a' [f64]
    [
        3.0
    ]
    z<expected at least one Series in 'cov' inputs if 'eager=True'c                óF    g | ]}t          |t          j        ¦  «        Æ|S r<   r   r   s     r6   r   zcov.<locals>.<listcomp>  r   r7   c              3  ó\   K   | ]'}t          |t          j        ¦  «        r|j        n|V  (d S rx   r   r   s     r6   r   zcov.<locals>.<genexpr>  r   r7   F)rr   rO   )r2   r   r$   r   r!   r   r   r   r   r   r4   )rs   rt   rO   rr   r   r   r   s          r6   r   r   Ķ  sį    šv š .Ż1biŃ(Ō(š 	"­J°q½"¼)Ń,DŌ,Dš 	"ŲPCŻS//Š!åŠLŠLØ!ØQØŠLŃLŌLŃMŌMŲMŠMĄqČ!ĄfŠMŃMŌMŲ||C Øeø$Š?Š?Š?Ń@Ō@×JŅJŃLŌLŠLå! !Ń$Ō$Ż! !Ń$Ō$Ż  A tŃ,Ō,Ń-Ō-Š-r7   r   śSequence[str] | Sequence[Expr]Śfunctionś$Callable[[Sequence[Series]], Series]Śreturn_dtypeśPolarsDataType | Nonec           	     ól    t          | ¦  «        } t          t          j        | ||dd¬¦  «        ¦  «        S )u>  
    Map a custom function over multiple columns/expressions.

    Produces a single Series result.

    Parameters
    ----------
    exprs
        Expression(s) representing the input Series to the function.
    function
        Function to apply over the input.
    return_dtype
        dtype of the output Series.

    Returns
    -------
    Expr
        Expression with the data type given by `return_dtype`.

    Examples
    --------
    >>> def test_func(a, b, c):
    ...     return a + b + c
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, 3, 4],
    ...         "b": [4, 5, 6, 7],
    ...     }
    ... )
    >>>
    >>> df.with_columns(
    ...     (
    ...         pl.struct(["a", "b"]).map_batches(
    ...             lambda x: test_func(x.struct.field("a"), x.struct.field("b"), 1)
    ...         )
    ...     ).alias("a+b+c")
    ... )
    shape: (4, 3)
    āāāāāāā¬āāāāāā¬āāāāāāāā
    ā a   ā b   ā a+b+c ā
    ā --- ā --- ā ---   ā
    ā i64 ā i64 ā i64   ā
    āāāāāāāŖāāāāāāŖāāāāāāāā”
    ā 1   ā 4   ā 6     ā
    ā 2   ā 5   ā 8     ā
    ā 3   ā 6   ā 10    ā
    ā 4   ā 7   ā 12    ā
    āāāāāāā“āāāāāā“āāāāāāāā
    F©Ś
map_groupsŚreturns_scalar©r   r   r4   Śmap_mul)r   r   r   s      r6   Śmap_batchesr§     sC    õl +Ø5Ń1Ō1EŻŻŲ8\°eČEš	
ń 	
ō 	
ńō š r7   )r¤   śSequence[str | Expr]ś*Callable[[Sequence[Series]], Series | Any]r¤   c          	     ól    t          | ¦  «        } t          t          j        | ||d|¬¦  «        ¦  «        S )uÅ	  
    Apply a custom/user-defined function (UDF) in a GroupBy context.

    .. warning::
        This method is much slower than the native expressions API.
        Only use it if you cannot implement your logic otherwise.

    Parameters
    ----------
    exprs
        Expression(s) representing the input Series to the function.
    function
        Function to apply over the input; should be of type Callable[[Series], Series].
    return_dtype
        dtype of the output Series.
    returns_scalar
        If the function returns a single scalar as output.

    Returns
    -------
    Expr
        Expression with the data type given by `return_dtype`.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "group": [1, 1, 2],
    ...         "a": [1, 3, 3],
    ...         "b": [5, 6, 7],
    ...     }
    ... )
    >>> df
    shape: (3, 3)
    āāāāāāāāā¬āāāāāā¬āāāāāā
    ā group ā a   ā b   ā
    ā ---   ā --- ā --- ā
    ā i64   ā i64 ā i64 ā
    āāāāāāāāāŖāāāāāāŖāāāāāā”
    ā 1     ā 1   ā 5   ā
    ā 1     ā 3   ā 6   ā
    ā 2     ā 3   ā 7   ā
    āāāāāāāāā“āāāāāā“āāāāāā
    >>> (
    ...     df.group_by("group").agg(
    ...         pl.map_groups(
    ...             exprs=["a", "b"],
    ...             function=lambda list_of_series: list_of_series[0]
    ...             / list_of_series[0].sum()
    ...             + list_of_series[1],
    ...             return_dtype=pl.Float64,
    ...         ).alias("my_custom_aggregation")
    ...     )
    ... ).sort("group")
    shape: (2, 2)
    āāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāā
    ā group ā my_custom_aggregation ā
    ā ---   ā ---                   ā
    ā i64   ā list[f64]             ā
    āāāāāāāāāŖāāāāāāāāāāāāāāāāāāāāāāāā”
    ā 1     ā [5.25, 6.75]          ā
    ā 2     ā [8.0]                 ā
    āāāāāāāāā“āāāāāāāāāāāāāāāāāāāāāāāā

    The output for group `1` can be understood as follows:

    - group `1` contains Series `'a': [1, 3]` and `'b': [5, 6]`
    - applying the function to those lists of Series, one gets the output
      `[1 / 4 + 5, 3 / 4 + 6]`, i.e. `[5.25, 6.75]`
    Tr¢   r„   )r   r   r   r¤   s       r6   r£   r£   T  sG    õZ +Ø5Ń1Ō1EŻŻŲŲŲŲŲ)š	
ń 	
ō 	
ńō š r7   ©r¤   r   Śaccś"Callable[[Series, Series], Series]śSequence[Expr | str] | Exprc          	     óČ    t          | d¬¦  «        } t          |t          j        ¦  «        r|g}t	          |¦  «        }t          t          j        | ||||¬¦  «        ¦  «        S )uč
  
    Accumulate over multiple columns horizontally/ row wise with a left fold.

    Parameters
    ----------
    acc
        Accumulator Expression. This is the value that will be initialized when the fold
        starts. For a sum this could for instance be lit(0).
    function
        Function to apply over the accumulator and the value.
        Fn(acc, value) -> new_value
    exprs
        Expressions to aggregate over. May also be a wildcard expression.
    returns_scalar
        Whether or not `function` applied returns a scalar. This must be set correctly
        by the user.
    return_dtype
            Output datatype.
            If not set, the dtype will be inferred based on the dtype
            of the accumulator.

    Notes
    -----
    If you simply want the first encountered expression as accumulator,
    consider using `reduce`.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, 3],
    ...         "b": [3, 4, 5],
    ...         "c": [5, 6, 7],
    ...     }
    ... )
    >>> df
    shape: (3, 3)
    āāāāāāā¬āāāāāā¬āāāāāā
    ā a   ā b   ā c   ā
    ā --- ā --- ā --- ā
    ā i64 ā i64 ā i64 ā
    āāāāāāāŖāāāāāāŖāāāāāā”
    ā 1   ā 3   ā 5   ā
    ā 2   ā 4   ā 6   ā
    ā 3   ā 5   ā 7   ā
    āāāāāāā“āāāāāā“āāāāāā

    Horizontally sum over all columns and add 1.

    >>> df.select(
    ...     pl.fold(
    ...         acc=pl.lit(1), function=lambda acc, x: acc + x, exprs=pl.col("*")
    ...     ).alias("sum"),
    ... )
    shape: (3, 1)
    āāāāāāā
    ā sum ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 10  ā
    ā 13  ā
    ā 16  ā
    āāāāāāā

    You can also apply a condition/predicate on all columns:

    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, 3],
    ...         "b": [0, 1, 2],
    ...     }
    ... )
    >>> df
    shape: (3, 2)
    āāāāāāā¬āāāāāā
    ā a   ā b   ā
    ā --- ā --- ā
    ā i64 ā i64 ā
    āāāāāāāŖāāāāāā”
    ā 1   ā 0   ā
    ā 2   ā 1   ā
    ā 3   ā 2   ā
    āāāāāāā“āāāāāā

    >>> df.filter(
    ...     pl.fold(
    ...         acc=pl.lit(True),
    ...         function=lambda acc, x: acc & x,
    ...         exprs=pl.col("*") > 1,
    ...     )
    ... )
    shape: (1, 2)
    āāāāāāā¬āāāāāā
    ā a   ā b   ā
    ā --- ā --- ā
    ā i64 ā i64 ā
    āāāāāāāŖāāāāāā”
    ā 3   ā 2   ā
    āāāāāāā“āāāāāā
    T©Ś
str_as_litr«   )r   r2   r   r"   r   r   r4   Śfold)r¬   r   r   r¤   r   s        r6   r²   r²   ­  st    õ\   °Š
5Ń
5Ō
5CŻ%Ń!Ō!š Ųå*Ø5Ń1Ō1EŻŻŲŲŲŲ)Ų%š	
ń 	
ō 	
ńō š r7   c                ó    t          |t          j        ¦  «        r|g}t          |¦  «        }t	          t          j        | |¦  «        ¦  «        S )u±  
    Accumulate over multiple columns horizontally/ row wise with a left fold.

    Parameters
    ----------
    function
        Function to apply over the accumulator and the value.
        Fn(acc, value) -> new_value
    exprs
        Expressions to aggregate over. May also be a wildcard expression.

    Notes
    -----
    See `fold` for the version with an explicit accumulator.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, 3],
    ...         "b": [0, 1, 2],
    ...     }
    ... )
    >>> df
    shape: (3, 2)
    āāāāāāā¬āāāāāā
    ā a   ā b   ā
    ā --- ā --- ā
    ā i64 ā i64 ā
    āāāāāāāŖāāāāāā”
    ā 1   ā 0   ā
    ā 2   ā 1   ā
    ā 3   ā 2   ā
    āāāāāāā“āāāāāā

    Horizontally sum over all columns.

    >>> df.select(
    ...     pl.reduce(function=lambda acc, x: acc + x, exprs=pl.col("*")).alias("sum")
    ... )
    shape: (3, 1)
    āāāāāāā
    ā sum ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 1   ā
    ā 3   ā
    ā 5   ā
    āāāāāāā
    )r2   r   r"   r   r   r4   Średuce©r   r   s     r6   r“   r“   +  sG    õn %Ń!Ō!š Ųå*Ø5Ń1Ō1EŻSZ Ø%Ń0Ō0Ń1Ō1Š1r7   )Śinclude_initr¶   c               óź    t          | d¬¦  «        } t          |t          j        ¦  «        r|g}t	          |¦  «        }t          t          j        | |||¦  «                             d¦  «        ¦  «        S )un  
    Cumulatively fold horizontally across columns with a left fold.

    Every cumulative result is added as a separate field in a Struct column.

    Parameters
    ----------
    acc
        Accumulator expression. This is the value that will be initialized when the fold
        starts. For a sum this could for instance be lit(0).
    function
        Function to apply over the accumulator and the value.
        Fn(acc, value) -> new_value
    exprs
        Expressions to aggregate over. May also be a wildcard expression.
    include_init
        Include the initial accumulator state as struct field.

    Notes
    -----
    If you simply want the first encountered expression as accumulator,
    consider using :func:`cum_reduce`.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, 3],
    ...         "b": [3, 4, 5],
    ...         "c": [5, 6, 7],
    ...     }
    ... )
    >>> df.with_columns(
    ...     pl.cum_fold(acc=pl.lit(1), function=lambda acc, x: acc + x, exprs=pl.all())
    ... )
    shape: (3, 4)
    āāāāāāā¬āāāāāā¬āāāāāā¬āāāāāāāāāāāā
    ā a   ā b   ā c   ā cum_fold  ā
    ā --- ā --- ā --- ā ---       ā
    ā i64 ā i64 ā i64 ā struct[3] ā
    āāāāāāāŖāāāāāāŖāāāāāāŖāāāāāāāāāāāā”
    ā 1   ā 3   ā 5   ā {2,5,10}  ā
    ā 2   ā 4   ā 6   ā {3,7,13}  ā
    ā 3   ā 5   ā 7   ā {4,9,16}  ā
    āāāāāāā“āāāāāā“āāāāāā“āāāāāāāāāāāā
    Tr°   Ścum_fold)	r   r2   r   r"   r   r   r4   rø   rD   )r¬   r   r   r¶   s       r6   rø   rø   i  sk    õl   °Š
5Ń
5Ō
5CŻ%Ń!Ō!š Ųå*Ø5Ń1Ō1EŻS\ # x°øŃEŌE×KŅKČJŃWŌWŃXŌXŠXr7   c                óÄ    t          |t          j        ¦  «        r|g}t          |¦  «        }t	          t          j        | |¦  «                             d¦  «        ¦  «        S )uź  
    Cumulatively reduce horizontally across columns with a left fold.

    Every cumulative result is added as a separate field in a Struct column.

    Parameters
    ----------
    function
        Function to apply over the accumulator and the value.
        Fn(acc, value) -> new_value
    exprs
        Expressions to aggregate over. May also be a wildcard expression.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, 3],
    ...         "b": [3, 4, 5],
    ...         "c": [5, 6, 7],
    ...     }
    ... )
    >>> df.with_columns(pl.cum_reduce(function=lambda acc, x: acc + x, exprs=pl.all()))
    shape: (3, 4)
    āāāāāāā¬āāāāāā¬āāāāāā¬āāāāāāāāāāāāā
    ā a   ā b   ā c   ā cum_reduce ā
    ā --- ā --- ā --- ā ---        ā
    ā i64 ā i64 ā i64 ā struct[3]  ā
    āāāāāāāŖāāāāāāŖāāāāāāŖāāāāāāāāāāāāā”
    ā 1   ā 3   ā 5   ā {1,4,9}    ā
    ā 2   ā 4   ā 6   ā {2,6,12}   ā
    ā 3   ā 5   ā 7   ā {3,8,15}   ā
    āāāāāāā“āāāāāā“āāāāāā“āāāāāāāāāāāāā
    Ś
cum_reduce)r2   r   r"   r   r   r4   rŗ   rD   rµ   s     r6   rŗ   rŗ   §  sU    õN %Ń!Ō!š Ųå*Ø5Ń1Ō1EŻS^ HØeŃ4Ō4×:Ņ:ø<ŃHŌHŃIŌIŠIr7   Śyś
str | ExprŚxc                óĘ   t          | t          ¦  «        rt          j        | ¦  «        } t          |t          ¦  «        rt          j        |¦  «        }t	          |d¦  «        s"dt          |¦  «         d}t          |¦  «        t	          | d¦  «        s"dt          | ¦  «         d}t          |¦  «        t          t          j	        | j
        |j
        ¦  «        ¦  «        S )uį  
    Compute two argument arctan in radians.

    Returns the angle (in radians) in the plane between the
    positive x-axis and the ray from the origin to (x,y).

    Parameters
    ----------
    y
        Column name or Expression.
    x
        Column name or Expression.

    Examples
    --------
    >>> c = (2**0.5) / 2
    >>> df = pl.DataFrame(
    ...     {
    ...         "y": [c, -c, c, -c],
    ...         "x": [c, c, -c, -c],
    ...     }
    ... )
    >>> df.with_columns(pl.arctan2("y", "x").alias("atan2"))
    shape: (4, 3)
    āāāāāāāāāāāāā¬āāāāāāāāāāāā¬āāāāāāāāāāāā
    ā y         ā x         ā atan2     ā
    ā ---       ā ---       ā ---       ā
    ā f64       ā f64       ā f64       ā
    āāāāāāāāāāāāāŖāāāāāāāāāāāāŖāāāāāāāāāāāā”
    ā 0.707107  ā 0.707107  ā 0.785398  ā
    ā -0.707107 ā 0.707107  ā -0.785398 ā
    ā 0.707107  ā -0.707107 ā 2.356194  ā
    ā -0.707107 ā -0.707107 ā -2.356194 ā
    āāāāāāāāāāāāā“āāāāāāāāāāāā“āāāāāāāāāāāā
    Ś_pyexprz,`arctan2` expected a `str` or `Expr` got a `ś`)r2   r3   r:   r;   Śhasattrr   Ś	TypeErrorr   r4   Śarctan2ræ   )r»   r½   r   s      r6   rĆ   rĆ   Õ  sŃ    õH !SŃŌš ŻE!HHŻ!SŃŌš ŻE!HHŻ1iŃ Ō š ŲVÕ=PŠQRŃ=SŌ=SŠVŠVŠVŻnnŠŻ1iŃ Ō š ŲVÕ=PŠQRŃ=SŌ=SŠVŠVŠVŻnnŠåS[ ¤ØA¬IŃ6Ō6Ń7Ō7Š7r7   zI`arctan2d` is deprecated; use `arctan2` followed by `.degrees()` instead.c                óF    t          | |¦  «                             ¦   «         S )u  
    Compute two argument arctan in degrees.

    .. deprecated:: 1.0.0
        Use `arctan2` followed by :meth:`Expr.degrees` instead.

    Returns the angle (in degrees) in the plane between the positive x-axis
    and the ray from the origin to (x,y).

    Parameters
    ----------
    y
        Column name or Expression.
    x
        Column name or Expression.

    Examples
    --------
    >>> c = (2**0.5) / 2
    >>> df = pl.DataFrame(
    ...     {
    ...         "y": [c, -c, c, -c],
    ...         "x": [c, c, -c, -c],
    ...     }
    ... )
    >>> df.select(  # doctest: +SKIP
    ...     pl.arctan2d("y", "x").alias("atan2d"),
    ...     pl.arctan2("y", "x").alias("atan2"),
    ... )
    shape: (4, 2)
    āāāāāāāāāā¬āāāāāāāāāāāā
    ā atan2d ā atan2     ā
    ā ---    ā ---       ā
    ā f64    ā f64       ā
    āāāāāāāāāāŖāāāāāāāāāāāā”
    ā 45.0   ā 0.785398  ā
    ā -45.0  ā -0.785398 ā
    ā 135.0  ā 2.356194  ā
    ā -135.0 ā -2.356194 ā
    āāāāāāāāāā“āāāāāāāāāāāā
    )rĆ   Śdegrees)r»   r½   s     r6   Śarctan2drĘ     s    õV 1a==× Ņ Ń"Ō"Š"r7   śCstr | PolarsDataType | Collection[str] | Collection[PolarsDataType]Śmore_columnsśstr | PolarsDataTypec                óB     t          j        d¦  «        j        | g|¢R  S )u   
    Represent all columns except for the given columns.

    Syntactic sugar for `pl.all().exclude(columns)`.

    Parameters
    ----------
    columns
        The name or datatype of the column(s) to exclude. Accepts regular expression
        input. Regular expressions should start with `^` and end with `$`.
    *more_columns
        Additional names or datatypes of columns to exclude, specified as positional
        arguments.

    Examples
    --------
    Exclude by column name(s):

    >>> df = pl.DataFrame(
    ...     {
    ...         "aa": [1, 2, 3],
    ...         "ba": ["a", "b", None],
    ...         "cc": [None, 2.5, 1.5],
    ...     }
    ... )
    >>> df.select(pl.exclude("ba"))
    shape: (3, 2)
    āāāāāāā¬āāāāāāā
    ā aa  ā cc   ā
    ā --- ā ---  ā
    ā i64 ā f64  ā
    āāāāāāāŖāāāāāāā”
    ā 1   ā null ā
    ā 2   ā 2.5  ā
    ā 3   ā 1.5  ā
    āāāāāāā“āāāāāāā

    Exclude by regex, e.g. removing all columns whose names end with the letter "a":

    >>> df.select(pl.exclude("^.*a$"))
    shape: (3, 1)
    āāāāāāāā
    ā cc   ā
    ā ---  ā
    ā f64  ā
    āāāāāāāā”
    ā null ā
    ā 2.5  ā
    ā 1.5  ā
    āāāāāāāā

    Exclude by dtype(s), e.g. removing all columns of type Int64 or Float64:

    >>> df.select(pl.exclude([pl.Int64, pl.Float64]))
    shape: (3, 1)
    āāāāāāāā
    ā ba   ā
    ā ---  ā
    ā str  ā
    āāāāāāāā”
    ā a    ā
    ā b    ā
    ā null ā
    āāāāāāāā

    Ś*)r:   r;   Śexclude)r>   rČ   s     r6   rĢ   rĢ   5  s(    šL 15::ŌgŠ5ØŠ5Š5Š5Š5r7   c                óN    t          j        | ¦  «                             ¦   «         S )z1Syntactic sugar for `pl.col("foo").agg_groups()`.)r:   r;   Ś
agg_groups)rN   s    r6   ŚgroupsrĻ   ~  s    å5==×#Ņ#Ń%Ō%Š%r7   ŚnearestŚquantileśfloat | ExprŚinterpolationr*   c                óR    t          j        | ¦  «                             ||¦  «        S )a$  
    Syntactic sugar for `pl.col("foo").quantile(..)`.

    Parameters
    ----------
    column
        Column name.
    quantile
        Quantile between 0.0 and 1.0.
    interpolation : {'nearest', 'higher', 'lower', 'midpoint', 'linear', 'equiprobable'}
        Interpolation method.
    )r:   r;   rŃ   )rN   rŃ   rÓ   s      r6   rŃ   rŃ     s"    õ" 5==×!Ņ! (ØMŃ:Ō:Š:r7   T)Ś
descendingŚ
nulls_lastŚmultithreadedŚmaintain_orderśIntoExpr | Iterable[IntoExpr]Ś
more_exprsrÕ   śbool | Sequence[bool]rÖ   r×   rŲ   c          	     óā    t          | g|¢R  } t          |t          | ¦  «        dd¦  «        }t          |t          | ¦  «        dd¦  «        }t          t	          j        | ||||¦  «        ¦  «        S )uŲ  
    Return the row indices that would sort the column(s).

    Parameters
    ----------
    exprs
        Column(s) to arg sort by. Accepts expression input. Strings are parsed as column
        names.
    *more_exprs
        Additional columns to arg sort by, specified as positional arguments.
    descending
        Sort in descending order. When sorting by multiple columns, can be specified
        per column by passing a sequence of booleans.
    nulls_last
        Place null values last.
    multithreaded
        Sort using multiple threads.
    maintain_order
        Whether the order should be maintained if elements are equal.

    See Also
    --------
    Expr.gather: Take values by index.
    Expr.rank : Get the rank of each row.

    Examples
    --------
    Pass a single column name to compute the arg sort by that column.

    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [0, 1, 1, 0],
    ...         "b": [3, 2, 3, 2],
    ...         "c": [1, 2, 3, 4],
    ...     }
    ... )
    >>> df.select(pl.arg_sort_by("a"))
    shape: (4, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā u32 ā
    āāāāāāā”
    ā 0   ā
    ā 3   ā
    ā 1   ā
    ā 2   ā
    āāāāāāā

    Compute the arg sort by multiple columns by either passing a list of columns, or by
    specifying each column as a positional argument.

    >>> df.select(pl.arg_sort_by(["a", "b"], descending=True))
    shape: (4, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā u32 ā
    āāāāāāā”
    ā 2   ā
    ā 1   ā
    ā 0   ā
    ā 3   ā
    āāāāāāā

    Use gather to apply the arg sort to other columns.

    >>> df.select(pl.col("c").gather(pl.arg_sort_by("a")))
    shape: (4, 1)
    āāāāāāā
    ā c   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 1   ā
    ā 4   ā
    ā 2   ā
    ā 3   ā
    āāāāāāā
    rÕ   r   rÖ   )r   r   rC   r   r4   Śarg_sort_by)r   rÕ   rÖ   r×   rŲ   rŚ   s         r6   rŻ   rŻ     ss    õp +Ø5Š>°:Š>Š>Š>EŻZ­ØU©¬°\Ą7ŃKŌKJŻZ­ØU©¬°\Ą7ŃKŌKJŻŻzØ:°}ĄnŃUŌUńō š r7   Śauto)Śtype_coercionŚpredicate_pushdownŚprojection_pushdownŚsimplify_expressionŚno_optimizationŚslice_pushdownŚcomm_subplan_elimŚcomm_subexpr_elimŚcluster_with_columnsŚcollapse_joinsŚoptimizationsŚengineŚlazy_framesśIterable[LazyFrame]rß   rą   rį   rā   rć   rä   rå   rę   rē   rč   ré   r+   rź   r&   ślist[DataFrame]c               ó    |dv rt          d¦  «         d | D ¦   «         }t          j        |||j        ¦  «        }d |D ¦   «         }|S )a  
    Collect multiple LazyFrames at the same time.

    This can run all the computation graphs in parallel or combined.

    Common Subplan Elimination is applied on the combined plan, meaning
    that diverging queries will run only once.

    Parameters
    ----------
    lazy_frames
        A list of LazyFrames to collect.
    type_coercion
        Do type coercion optimization.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    predicate_pushdown
        Do predicate pushdown optimization.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    projection_pushdown
        Do projection pushdown optimization.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    simplify_expression
        Run simplify expressions optimization.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    no_optimization
        Turn off optimizations.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    slice_pushdown
        Slice pushdown optimization.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    comm_subplan_elim
        Will try to cache branching subplans that occur on self-joins or unions.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    comm_subexpr_elim
        Common subexpressions will be cached and reused.

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    cluster_with_columns
        Combine sequential independent calls to with_columns

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    collapse_joins
        Collapse a join and filters into a faster join

        .. deprecated:: 1.30.0
            Use the `optimizations` parameters.
    optimizations
        The optimization passes done during query optimization.

        .. warning::
            This functionality is considered **unstable**. It may be changed
            at any point without it being considered a breaking change.
    engine
        Select the engine used to process the query, optional.
        At the moment, if set to `"auto"` (default), the query
        is run using the polars in-memory engine. Polars will also
        attempt to use the engine set by the `POLARS_ENGINE_AFFINITY`
        environment variable. If it cannot run the query using the
        selected engine, the query is run using the polars in-memory
        engine.

        .. note::
           The GPU engine does not support async, or running in the
           background. If either are enabled, then GPU execution is switched off.

    Returns
    -------
    list of DataFrames
        The collected DataFrames, returned in the same order as the input LazyFrames.

    ©Ś	streamingzold-streamingś&streaming mode is considered unstable.c                ó    g | ]	}|j         
S r<   ©Ś_ldf©r   Ślfs     r6   r   zcollect_all.<locals>.<listcomp>c  ó    Š
)Š
)Š
)r27Š
)Š
)Š
)r7   c                ó,    g | ]}t          |¦  «        S r<   )r   )r   Śpydfs     r6   r   zcollect_all.<locals>.<listcomp>g  s    Š,Š,Š, gdmmŠ,Š,Š,r7   )r   r4   Ścollect_allŚ_pyoptflags)rė   rß   rą   rį   rā   rć   rä   rå   rę   rē   rč   ré   rź   ŚlfsŚoutŚresults                   r6   rś   rś   ÷  sc    šR Š/Š/Š/ŻŠGŃHŌHŠHą
)Š
)[Š
)Ń
)Ō
)CŻ
/#v }Ō'@Ń
AŌ
ACš -Š,ØŠ,Ń,Ō,FąMr7   )rź   ré   Śgeventś'_GeventDataFrameResult[list[DataFrame]]c               ó    d S rx   r<   ©rė   r’   rź   ré   s       r6   Ścollect_all_asyncr  l  s	    š /2Øcr7   )r’   rź   ré   śAwaitable[list[DataFrame]]c               ó    d S rx   r<   r  s       r6   r  r  v  s	    š "% r7   śDAwaitable[list[DataFrame]] | _GeventDataFrameResult[list[DataFrame]]c               óĀ    |dv rt          d¦  «         |rt          ¦   «         nt          ¦   «         }d | D ¦   «         }t          j        |||j        |j        ¦  «         |S )a;  
    Collect multiple LazyFrames at the same time asynchronously in thread pool.

    .. warning::
        This functionality is considered **unstable**. It may be changed
        at any point without it being considered a breaking change.

    Collects into a list of DataFrame (like :func:`polars.collect_all`),
    but instead of returning them directly, they are scheduled to be collected
    inside thread pool, while this method returns almost instantly.

    May be useful if you use gevent or asyncio and want to release control to other
    greenlets/tasks while LazyFrames are being collected.

    Parameters
    ----------
    lazy_frames
        A list of LazyFrames to collect.
    gevent
        Return wrapper to `gevent.event.AsyncResult` instead of Awaitable
    optimizations
        The optimization passes done during query optimization.

        .. warning::
            This functionality is considered **unstable**. It may be changed
            at any point without it being considered a breaking change.
    engine
        Select the engine used to process the query, optional.
        At the moment, if set to `"auto"` (default), the query
        is run using the polars in-memory engine. Polars will also
        attempt to use the engine set by the `POLARS_ENGINE_AFFINITY`
        environment variable. If it cannot run the query using the
        selected engine, the query is run using the polars in-memory
        engine.

        .. note::
           The GPU engine does not support async, or running in the
           background. If either are enabled, then GPU execution is switched off.

    See Also
    --------
    polars.collect_all : Collect multiple LazyFrames at the same time.
    LazyFrame.collect_async : To collect single frame.

    Notes
    -----
    In case of error `set_exception` is used on
    `asyncio.Future`/`gevent.event.AsyncResult` and will be reraised by them.

    Returns
    -------
    If `gevent=False` (default) then returns awaitable.

    If `gevent=True` then returns wrapper that has
    `.get(block=True, timeout=None)` method.
    rļ   rń   c                ó    g | ]	}|j         
S r<   ró   rõ   s     r6   r   z%collect_all_async.<locals>.<listcomp>Ē  r÷   r7   )r   r
   r	   r4   Ścollect_all_with_callbackrū   Ś_callback_all)rė   r’   rź   ré   rž   rü   s         r6   r  r    s    šB Š/Š/Š/ŻŠGŃHŌHŠHš %+ŠEÕŃ Ō Š Õ0CŃ0EŌ0Eš š *Š
)[Š
)Ń
)Ō
)CŻŌ!ŲV]Ō.°Ō0Dńō š š Mr7   )ré   c               óN    d | D ¦   «         }t          j        ||j        ¦  «        S )a>  
    Explain multiple LazyFrames as if passed to `collect_all`.

    Common Subplan Elimination is applied on the combined plan, meaning
    that diverging queries will run only once.

    Parameters
    ----------
    lazy_frames
        A list of LazyFrames to collect.
    optimizations
        The optimization passes done during query optimization.

        .. warning::
            This functionality is considered **unstable**. It may be changed
            at any point without it being considered a breaking change.

    Returns
    -------
    Explained plan.
    c                ó    g | ]	}|j         
S r<   ró   rõ   s     r6   r   zexplain_all.<locals>.<listcomp>é  r÷   r7   )r4   Śexplain_allrū   )rė   ré   rü   s      r6   r  r  Ī  s,    š6 *Š
)[Š
)Ń
)Ō
)CŻ?3 Ō 9Ń:Ō:Š:r7   ©rr   Śnamed_exprsr!   c                ó    d S rx   r<   ©rr   r   r  s      r6   r   r   ķ  ó	    š
 r7   r#   c                ó    d S rx   r<   r  s      r6   r   r   õ  r  r7   śDataFrame | LazyFramec                ól    | rt          j        ¦   «         nt          j        ¦   «         } |j        |i |¤S )uÄ  
    Run polars expressions without a context.

    This is syntactic sugar for running `df.select` on an empty DataFrame
    (or LazyFrame if eager=False).

    Parameters
    ----------
    *exprs
        Column(s) to select, specified as positional arguments.
        Accepts expression input. Strings are parsed as column names,
        other non-expression inputs are parsed as literals.
    eager
        Evaluate immediately and return a `DataFrame` (default); if set to `False`,
        return a `LazyFrame` instead.
    **named_exprs
        Additional columns to select, specified as keyword arguments.
        The columns will be renamed to the keyword used.

    Returns
    -------
    DataFrame or LazyFrame

    Examples
    --------
    >>> foo = pl.Series("foo", [1, 2, 3])
    >>> bar = pl.Series("bar", [3, 2, 1])
    >>> pl.select(min=pl.min_horizontal(foo, bar))
    shape: (3, 1)
    āāāāāāā
    ā min ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 1   ā
    ā 2   ā
    ā 1   ā
    āāāāāāā

    >>> pl.select(pl.int_range(0, 100_000, 2).alias("n"), eager=False).filter(
    ...     pl.col("n") % 22_500 == 0
    ... ).collect()
    shape: (5, 1)
    āāāāāāāāā
    ā n     ā
    ā ---   ā
    ā i64   ā
    āāāāāāāāā”
    ā 0     ā
    ā 22500 ā
    ā 45000 ā
    ā 67500 ā
    ā 90000 ā
    āāāāāāāāā
    )r   r!   r#   r   )rr   r   r  Śempty_frames       r6   r   r   ż  s7    št %*Š=",...­r¬|©~¬~KŲ;ŌuŠ4ØŠ4Š4Š4r7   Ś	conditionc               ó    d S rx   r<   ©r  rr   s     r6   Ś	arg_wherer  ;  s    ŲQTŠQTr7   c               ó    d S rx   r<   r  s     r6   r  r  ?  ó    ŲLOČCr7   c               ó    |rt          | t          j        ¦  «        s&dt          | ¦  «        j        }t          |¦  «        |                      ¦   «                              t          t          j
        | j        ¦  «        ¦  «        ¦  «                             ¦   «         S t          | ¦  «        } t          t          j        | ¦  «        ¦  «        S )a·  
    Return indices where `condition` evaluates `True`.

    Parameters
    ----------
    condition
        Boolean expression to evaluate
    eager
        Evaluate immediately and return a `Series`; this requires that the given
        condition is itself a `Series`. If set to `False` (default), return
        an expression instead.

    See Also
    --------
    Series.arg_true : Return indices where Series is True

    Examples
    --------
    >>> df = pl.DataFrame({"a": [1, 2, 3, 4, 5]})
    >>> df.select(
    ...     [
    ...         pl.arg_where(pl.col("a") % 2 == 0),
    ...     ]
    ... ).to_series()
    shape: (2,)
    Series: 'a' [u32]
    [
        1
        3
    ]
    z4expected Series in 'arg_where' if 'eager=True', got )r2   r   r$   ŚtypeŚ__name__r   Śto_framer   r  r:   r;   r.   r   r   r   r4   )r  rr   r   s      r6   r  r  C  s“    š@ š 
3Ż)„R¤YŃ/Ō/š 	"š1ŻOOŌ,š1š 1š õ S//Š!Ų×!Ņ!Ń#Ō#×*Ņ*­9µQ“Uø9¼>Ń5JŌ5JŃ+KŌ+KŃLŌL×VŅVŃXŌXŠXå)Ø)Ń4Ō4	Ż yŃ1Ō1Ń2Ō2Š2r7   c               ó    d S rx   r<   ©r   rr   rŚ   s      r6   Ścoalescer#  p  s	    š
 3r7   c               ó    d S rx   r<   r"  s      r6   r#  r#  x  s	    š
 Sr7   c               ó    d S rx   r<   r"  s      r6   r#  r#    s	    š
 Cr7   c               óR   |rx| g|¢} d | D ¦   «         x}sd}t          |¦  «        d | D ¦   «         } t          j        |¦  «                             t	          | d¬¦  «        ¦  «                             ¦   «         S t          | g|¢R  } t          t          j        | ¦  «        ¦  «        S )u	  
    Folds the columns from left to right, keeping the first non-null value.

    Parameters
    ----------
    exprs
        Columns to coalesce. Accepts expression input. Strings are parsed as column
        names, other non-expression inputs are parsed as literals.
    *more_exprs
        Additional columns to coalesce, specified as positional arguments.
    eager
        Evaluate immediately and return a `Series`; this requires that at least one
        of the given arguments is a `Series`. If set to `False` (default), return
        an expression instead.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, None, None, None],
    ...         "b": [1, 2, None, None],
    ...         "c": [5, None, 3, None],
    ...     }
    ... )

    >>> df.with_columns(pl.coalesce("a", "b", "c", 10).alias("d"))
    shape: (4, 4)
    āāāāāāāā¬āāāāāāā¬āāāāāāā¬āāāāāā
    ā a    ā b    ā c    ā d   ā
    ā ---  ā ---  ā ---  ā --- ā
    ā i64  ā i64  ā i64  ā i64 ā
    āāāāāāāāŖāāāāāāāŖāāāāāāāŖāāāāāā”
    ā 1    ā 1    ā 5    ā 1   ā
    ā null ā 2    ā null ā 2   ā
    ā null ā null ā 3    ā 3   ā
    ā null ā null ā null ā 10  ā
    āāāāāāāā“āāāāāāā“āāāāāāā“āāāāāā

    >>> df.with_columns(pl.coalesce(pl.col(["a", "b", "c"]), 10.0).alias("d"))
    shape: (4, 4)
    āāāāāāāā¬āāāāāāā¬āāāāāāā¬āāāāāāā
    ā a    ā b    ā c    ā d    ā
    ā ---  ā ---  ā ---  ā ---  ā
    ā i64  ā i64  ā i64  ā f64  ā
    āāāāāāāāŖāāāāāāāŖāāāāāāāŖāāāāāāā”
    ā 1    ā 1    ā 5    ā 1.0  ā
    ā null ā 2    ā null ā 2.0  ā
    ā null ā null ā 3    ā 3.0  ā
    ā null ā null ā null ā 10.0 ā
    āāāāāāāā“āāāāāāā“āāāāāāā“āāāāāāā

    >>> s1 = pl.Series("a", [None, 2, None])
    >>> s2 = pl.Series("b", [1, None, 3])
    >>> pl.coalesce(s1, s2, eager=True)
    shape: (3,)
    Series: 'a' [i64]
    [
        1
        2
        3
    ]
    c                óF    g | ]}t          |t          j        ¦  «        Æ|S r<   r   r   s     r6   r   zcoalesce.<locals>.<listcomp>Ķ  s)    ŠHŠHŠH ­zø!½R¼YŃ/GŌ/GŠH1ŠHŠHŠHr7   z:expected at least one Series in 'coalesce' if 'eager=True'c                óT    g | ]%}t          |t          j        ¦  «        r|j        n|&S r<   r   r   s     r6   r   zcoalesce.<locals>.<listcomp>Ń  s/    ŠLŠLŠLĄJ q­"¬)Ń4Ō4Š;!&&ø!ŠLŠLŠLr7   Fr  )	r   r   r!   r   r#  r   r   r   r4   )r   rr   rŚ   Śseriesr   s        r6   r#  r#    s½    šF š 
.ŲŠ$Š$ŲHŠH eŠHŃHŌHŠHš 	"ŲNCŻS//Š!ąLŠLĄeŠLŃLŌLŻ|FŃ#Ō#×*Ņ*­8°EĄŠ+GŃ+GŌ+GŃHŌH×RŅRŃTŌTŠTå.ØuŠB°zŠBŠBŠBŻ eŃ,Ō,Ń-Ō-Š-r7   Ś	time_unitr'   c                ó    d S rx   r<   ©rN   r*  s     r6   Ś
from_epochr-  Ų  r  r7   śSeries | Sequence[int]c                ó    d S rx   r<   r,  s     r6   r-  r-  Ü  s	    š Sr7   Śsś#str | Expr | Series | Sequence[int]c                ó   t          | t          ¦  «        rt          j        | ¦  «        } n:t          | t          j        t          j        f¦  «        st	          j        | ¦  «        } |dk    r|                      t          ¦  «        S |dk    r=|                      t          ¦  «        dz                       t          d¦  «        ¦  «        S |t          v r"|                      t          |¦  «        ¦  «        S d|}t          |¦  «        )u¢  
    Utility function that parses an epoch timestamp (or Unix time) to Polars Date(time).

    Depending on the `time_unit` provided, this function will return a different dtype:

    - time_unit="d" returns pl.Date
    - time_unit="s" returns pl.Datetime["us"] (pl.Datetime's default)
    - time_unit="ms" returns pl.Datetime["ms"]
    - time_unit="us" returns pl.Datetime["us"]
    - time_unit="ns" returns pl.Datetime["ns"]

    Parameters
    ----------
    column
        Series or expression to parse integers to pl.Datetime.
    time_unit
        The unit of time of the timesteps since epoch time.

    Examples
    --------
    >>> df = pl.DataFrame({"timestamp": [1666683077, 1666683099]}).lazy()
    >>> df.select(pl.from_epoch(pl.col("timestamp"), time_unit="s")).collect()
    shape: (2, 1)
    āāāāāāāāāāāāāāāāāāāāāāā
    ā timestamp           ā
    ā ---                 ā
    ā datetime[Ī¼s]        ā
    āāāāāāāāāāāāāāāāāāāāāāā”
    ā 2022-10-25 07:31:17 ā
    ā 2022-10-25 07:31:39 ā
    āāāāāāāāāāāāāāāāāāāāāāā

    The function can also be used in an eager context by passing a Series.

    >>> s = pl.Series([12345, 12346])
    >>> pl.from_epoch(s, time_unit="d")
    shape: (2,)
    Series: '' [date]
    [
            2003-10-20
            2003-10-21
    ]
    Śdr0  i@B Śusz=`time_unit` must be one of {'ns', 'us', 'ms', 's', 'd'}, got )r2   r3   r:   r;   r   r$   r"   Ścastr   r   r   r   r   )rN   r*  r   s      r6   r-  r-  ā  sć    õ\ &#ŃŌš #ŻvŻ„¤­B¬GŠ 4Ń5Ō5š #Ż6Ń"Ō"ąCŅŠŲ{{4Ń Ō Š Ų	cŅ	Š	ŲEŃ"Ō" YŃ.×4Ņ4µXød±^“^ŃDŌDŠDŲ	Õ*Š	*Š	*Ų{{8 IŃ.Ō.Ń/Ō/Š/ą]ŠPYŠ]Š]ŻooŠr7   Śmin_periodsŚmin_samplesz1.21.0r@   )r7  rO   Świndow_sizec          	     ó   ||}t          | t          ¦  «        rt          j        | ¦  «        } t          |t          ¦  «        rt          j        |¦  «        }t	          t          j        | j        |j        |||¦  «        ¦  «        S )aé  
    Compute the rolling covariance between two columns/ expressions.

    The window at a given row includes the row itself and the
    `window_size - 1` elements before it.

    .. versionchanged:: 1.21.0
        The `min_periods` parameter was renamed `min_samples`.

    Parameters
    ----------
    a
        Column name or Expression.
    b
        Column name or Expression.
    window_size
        The length of the window.
    min_samples
        The number of values in the window that should be non-null before computing
        a result. If None, it will be set equal to window size.
    ddof
        Delta degrees of freedom. The divisor used in calculations
        is `N - ddof`, where `N` represents the number of elements.
    )r2   r3   r:   r;   r   r4   Śrolling_covræ   ©rs   rt   r8  r7  rO   s        r6   r:  r:   	  sy    šB ŠŲ!Ż!SŃŌš ŻE!HHŻ!SŃŌš ŻE!HHŻŻ	 1¤9Økø;ČŃMŌMńō š r7   c          	     ó   ||}t          | t          ¦  «        rt          j        | ¦  «        } t          |t          ¦  «        rt          j        |¦  «        }t	          t          j        | j        |j        |||¦  «        ¦  «        S )aź  
    Compute the rolling correlation between two columns/ expressions.

    The window at a given row includes the row itself and the
    `window_size - 1` elements before it.

    .. versionchanged:: 1.21.0
        The `min_periods` parameter was renamed `min_samples`.

    Parameters
    ----------
    a
        Column name or Expression.
    b
        Column name or Expression.
    window_size
        The length of the window.
    min_samples
        The number of values in the window that should be non-null before computing
        a result. If None, it will be set equal to window size.
    ddof
        Delta degrees of freedom. The divisor used in calculations
        is `N - ddof`, where `N` represents the number of elements.
    )r2   r3   r:   r;   r   r4   Śrolling_corrræ   r;  s        r6   r=  r=  L	  sz    šB ŠŲ!Ż!SŃŌš ŻE!HHŻ!SŃŌš ŻE!HHŻŻŌ A¤IØ{øKČŃNŌNńō š r7   Śsqlc                ó    d S rx   r<   ©r>  s    r6   Śsql_exprrA  x	  s    ąCr7   śSequence[str]ś
list[Expr]c                ó    d S rx   r<   r@  s    r6   rA  rA  }	  s    Ų03°r7   śstr | Sequence[str]śExpr | list[Expr]c                ó    t          | t          ¦  «        r!t          t          j        | ¦  «        ¦  «        S d | D ¦   «         S )uó  
    Parse one or more SQL expressions to Polars expression(s).

    Parameters
    ----------
    sql
        One or more SQL expressions.

    Examples
    --------
    Parse a single SQL expression:

    >>> df = pl.DataFrame({"a": [2, 1]})
    >>> expr = pl.sql_expr("MAX(a)")
    >>> df.select(expr)
    shape: (1, 1)
    āāāāāāā
    ā a   ā
    ā --- ā
    ā i64 ā
    āāāāāāā”
    ā 2   ā
    āāāāāāā

    Parse multiple SQL expressions:

    >>> df.with_columns(
    ...     *pl.sql_expr(["POWER(a,a) AS a_a", "CAST(a AS TEXT) AS a_txt"]),
    ... )
    shape: (2, 3)
    āāāāāāā¬āāāāāā¬āāāāāāāā
    ā a   ā a_a ā a_txt ā
    ā --- ā --- ā ---   ā
    ā i64 ā i64 ā str   ā
    āāāāāāāŖāāāāāāŖāāāāāāāā”
    ā 2   ā 4   ā 2     ā
    ā 1   ā 1   ā 1     ā
    āāāāāāā“āāāāāā“āāāāāāāā
    c                óP    g | ]#}t          t          j        |¦  «        ¦  «        $S r<   )r   r4   rA  )r   Śqs     r6   r   zsql_expr.<locals>.<listcomp>¬	  s(    Š8Š8Š8Øq	#, q//Ń*Ō*Š8Š8Š8r7   )r2   r3   r   r4   rA  r@  s    r6   rA  rA  	  sC    õP #sŃŌš 9Ż cŃ*Ō*Ń+Ō+Š+ą8Š8°CŠ8Ń8Ō8Š8r7   )r.   r/   r0   r"   )r0   r"   )r>   r3   r0   r"   )r>   r3   rG   rH   r0   r"   )rM   )rN   r3   rO   rP   r0   r"   )rc   rd   r0   r"   )rh   )rN   r3   ri   rP   r0   r"   )rs   r(   rt   r(   rp   r%   rO   ru   rq   rH   rr   rv   r0   r"   )rs   r(   rt   r(   rp   r%   rO   ru   rq   rH   rr   r{   r0   r$   )rs   r(   rt   r(   rp   r%   rO   ru   rq   rH   rr   rH   r0   r~   )
rs   r(   rt   r(   rO   rP   rr   rv   r0   r"   )
rs   r(   rt   r(   rO   rP   rr   r{   r0   r$   )
rs   r(   rt   r(   rO   rP   rr   rH   r0   r~   rx   )r   r   r   r   r   r    r0   r"   )
r   rØ   r   r©   r   r    r¤   rH   r0   r"   )r¬   r(   r   r­   r   r®   r¤   rH   r   r    r0   r"   )r   r­   r   r®   r0   r"   )
r¬   r(   r   r­   r   r®   r¶   rH   r0   r"   )r»   r¼   r½   r¼   r0   r"   )r>   rĒ   rČ   rÉ   r0   r"   )rN   r3   r0   r"   )rŠ   )rN   r3   rŃ   rŅ   rÓ   r*   r0   r"   )r   rŁ   rŚ   r(   rÕ   rŪ   rÖ   rŪ   r×   rH   rŲ   rH   r0   r"   )rė   rģ   rß   rH   rą   rH   rį   rH   rā   rH   rć   rH   rä   rH   rå   rH   rę   rH   rē   rH   rč   rH   ré   r+   rź   r&   r0   rķ   )
rė   rģ   r’   r{   rź   r&   ré   r+   r0   r   )
rė   rģ   r’   rv   rź   r&   ré   r+   r0   r  )
rė   rģ   r’   rH   rź   r&   ré   r+   r0   r  )rė   rģ   ré   r+   r0   r3   )r   rŁ   rr   r{   r  r(   r0   r!   )r   rŁ   rr   rv   r  r(   r0   r#   )r   rŁ   rr   rH   r  r(   r0   r  )r  r~   rr   rv   r0   r"   )r  r~   rr   r{   r0   r$   )r  r~   rr   rH   r0   r~   )r   rŁ   rŚ   r(   rr   rv   r0   r"   )r   rŁ   rŚ   r(   rr   r{   r0   r$   )r   rŁ   rŚ   r(   rr   rH   r0   r~   ).)rN   r¼   r*  r'   r0   r"   )rN   r.  r*  r'   r0   r$   )r0  )rN   r1  r*  r'   r0   r~   )rs   r¼   rt   r¼   r8  rP   r7  ru   rO   rP   r0   r"   )r>  r3   r0   r"   )r>  rB  r0   rC  )r>  rE  r0   rF  )mŚ
__future__r   Ś
contextlibŚcollections.abcr   Śtypingr   r   r   r   Śpolars._reexportŚ	_reexportr   Śpolars.functionsŚ	functionsr:   Śpolars._utils.async_r	   r
   Śpolars._utils.deprecationr   r   r   r   Śpolars._utils.parser   r   Śpolars._utils.unstabler   r   Śpolars._utils.variousr   r   Śpolars._utils.wrapr   r   Śpolars.datatypesr   r   r   r   Śpolars.lazyframe.opt_flagsr   r   ŚsuppressŚImportErrorŚpolars.polarsŚpolarsr4   Śsysr   r   r   r    r!   r"   r#   r$   Śpolars._typingr%   r&   r'   r(   r)   r*   r+   Śversion_infoŚwarningsŚtyping_extensionsr5   r=   rB   rJ   rL   rR   rV   rX   rZ   r\   r^   r`   rb   rg   rk   ro   rz   r   r§   r£   r²   r“   rø   rŗ   rĆ   rĘ   rĢ   rĻ   rŃ   rŻ   rś   r  r  r   r  r#  r-  r:  r=  rA  r<   r7   r6   ś<module>rc     sq  šŲ "Š "Š "Š "Š "Š "ą Š Š Š Ų $Š $Š $Š $Š $Š $Ų 9Š 9Š 9Š 9Š 9Š 9Š 9Š 9Š 9Š 9Š 9Š 9ą Š Š Š Š Š Ų Š Š Š Š Š Ų LŠ LŠ LŠ LŠ LŠ LŠ LŠ Lšš š š š š š š š š š š šš š š š š š š š DŠ CŠ CŠ CŠ CŠ CŠ CŠ CŲ BŠ BŠ BŠ BŠ BŠ BŠ BŠ BŲ 1Š 1Š 1Š 1Š 1Š 1Š 1Š 1Ų HŠ HŠ HŠ HŠ HŠ HŠ HŠ HŠ HŠ HŠ HŠ Hšš š š š š š š š
 ZŌŃ%Ō%š  š  ŲŠŠŠŠŠš š  š  ń  ō  š  š  š  š  š  š  ųųųš  š  š  š  š š 1ŲJJJŲ?Š?Š?Š?Š?Š?Š?Š?Š?Š?ŲŠŠŠŠŠą9Š9Š9Š9Š9Š9Š9Š9Š9Š9Š9Š9šš š š š š š š š š š š š š š š šš š š š š š Ō7Ņ"Š"Ų'Š'Š'Š'Š'Š'Š'ą0Š0Š0Š0Š0Š0š	&š 	&š 	&š 	&šDš Dš Dš DšNJ#š J#š J#š J#šZ .3š 6š 6š 6š 6š 6š 6š>(%š (%š (%š (%šV$#š $#š $#š $#š $#šN$#š $#š $#š $#š $#šN,"š ,"š ,"š ,"š^($š ($š ($š ($šV(&š (&š (&š (&šV)-š )-š )-š )-šX>#š >#š >#š >#šB>"š >"š >"š >"šB,.š ,.š ,.š ,.š^,!š ,!š ,!š ,!š ,!š^,!š ,!š ,!š ,!š ,!š^ 
š
 !$ŲŲŲšš š š š ń 
šš 
š
 !$ŲŲšš š š š ń 
šš !*ŲŲ Ųšn"š n"š n"š n"š n"š n"šb 
š
 Ųšš š š š ń 
šš 
š
 š	š š š š ń 
šš ŲšF.š F.š F.š F.š F.š F.šX +/š;š ;š ;š ;š ;šB +/šVš
 !šVš Vš Vš Vš Vš Vš| !Ų*.š{š {š {š {š {š {š|;2š ;2š ;2š ;2šF š;Yš ;Yš ;Yš ;Yš ;Yš ;Yš|+Jš +Jš +Jš +Jš\/8š /8š /8š /8šd ŠWŃXŌXš*#š *#š *#ń YŌXš*#šZF6š F6š F6š F6šR&š &š &š &š %.š;š ;š ;š ;š ;š. ).Ų(-ŲŲ š]š ]š ]š ]š ]š ]š@ ŠŃ Ō ŲŠŃŌš Ų#Ų $Ų $Ų!ŲŲ"Ų"Ų!%ŲŲ#:Ųšpš pš pš pš pń Ōń !Ō špšf 
š
  Ų#:š2š 2š 2š 2š 2ń 
š2š 
š #ŲŲ#:š%š %š %š %š %ń 
š%š 
ŲŠŃ Ō š ŲŲ#:šIš Iš Iš Iš Iń !Ō ń šIšX 
š $;š;š ;š ;š ;š ;ń š;š< 
š šš š š š ń 
šš 
šš š ń 
šš :>š;5š ;5š ;5š ;5š ;5š ;5š| 
ŲCFŠ TŠ TŠ TŠ TŠ Tń 
Ų Tš 
Ų OŠ OŠ Oń 
Ų Oš :?š *3š *3š *3š *3š *3š *3šZ 
š  šš š š š ń 
šš 
šš š ń 
šš 
šš š ń 
šš šM.š M.š M.š M.š M.š M.š` 
Ų OŠ OŠ OŠ Oń 
Ų Oš 
ą?Bšš š š ń 
šš MPš;š ;š ;š ;š ;š| Š]ØMĄ8ŠLŃLŌLš #Ųš(š (š (š (š (ń MŌLš(šV Š]ØMĄ8ŠLŃLŌLš #Ųš(š (š (š (š (ń MŌLš(šV 
šš š ń 
šš 
Ų 3Š 3Š 3ń 
Ų 3š+9š +9š +9š +9š +9š +9s   ĀBĀBĀB