ó
    ŕ'ˇh­< ă                  óä	   S SK Jr  S SKrS SKJrJrJrJr  S SKJ	r
  S SKJr  S SKJr  S SKJrJr  S SKJrJrJrJr  S SKJrJr  S SKJrJr  S SKJ r J!r!  S S	K"J#r#J$r$J%r%  S S
K&J'r'J(r(J)r)J*r*  S SK+J,r,  S SK-J.r.  S SK-J/r0  S SK1J2r2J3r3  S SK4J5r5  \Rl                  " \75         S SK8J9r:  SSS5        \(       aU  S SK;r;S SK<J=r=J>r>J?r?J@r@  S SKJArA  S SKBJCrCJDrDJErEJFrF  S SKGJHrHJIrIJJrJJKrKJLrLJMrM  S SK1JNrN  \;R                  S:ź  a  S SKPJr  OS SKQJr  SqS jrRSrS jrSSsS jrTSS.StS jjrUSsS jrVSuSvS jjrWSuSvS  jjrXSsS! jrYSsS" jrZSsS# jr[SsS$ jr\SsS% jr]SsS& jr^S'S(.SwS) jjr_SxSyS* jjr`SxSyS+ jjra\S,S,S,S,S-.             SzS. jj5       rb\S,S,S,S/.             S{S0 jj5       rbS1SSSS-.             S|S2 jjrb\S,S,S3.         S}S4 jj5       rc\S,S5.         S~S6 jj5       rcSSS3.         SS7 jjrc " S8 S95      rd SSSS:.           SS; jjjre SSSS:.           SS< jjjrfSSSS=.         SS> jjrg    SS? jrhSSS@.           SSA jjriSSS@.         SSB jjrjSSSSC.             SSD jjrkSSS@.         SSE jjrlSSF jrm\" SG5      SSH j5       rn      SSI jroSSJ jrp S       SSK jjrqSSS'SSL.             SSM jjrr\" 5       \3" 5       S'S'S'S'SS'S'S'S'S'\2SNSO.                           SSP jj5       5       rs\SN\2SQ.         SSR jj5       rt\SSN\2SS.         SST jj5       rt\" 5       \" 5       SSN\2SS.         SSU jj5       5       rt\" 5       \2SV.     SSW jj5       ru\S,SX.       SSY jj5       rv\        SSZ j5       rvS'SX.       SS[ jjrv\S,SX.SS\ jj5       rw\SS] j5       rwSSX.SS^ jjrw\S,SX.       SS_ jj5       rx\        SS` j5       rx\        SSa j5       rxSSX.       SSb jjrx\SSSc jj5       ry\ S     SSd jj5       ry S     SSe jjry\" SfSgShSi9SSSj.           S Sk jj5       rz\" SfSgShSi9SSSj.           S Sl jj5       r{\SĄSm j5       r|\S˘Sn j5       r|SŁSo jr|\" 5       S¤SĽSp jj5       r}g! , (       d  f       GNC= f)Śé    )ÚannotationsN)Ú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Úwrap_s)ÚDTYPE_TEMPORAL_UNITSÚDateÚDatetimeÚInt64)Úparse_into_datatype_expr)Ú_check_for_numpy)Únumpy)ÚDEFAULT_QUERY_OPT_FLAGSÚforward_old_opt_flags)Úget_index_type)Ú	AwaitableÚ
CollectionÚIterableÚSequence)ÚLiteral)Ú	DataFrameÚExprÚ	LazyFrameÚSeries)ÚCorrelationMethodÚ
EngineTypeÚEpochTimeUnitÚIntoExprÚPolarsDataTypeÚQuantileMethod)ÚQueryOptFlags)é   é   )r   c                óp    [        U [        5      (       a  U /n [        [        R                  " U 5      5      $ )ze
Select a field in the current `struct.with_fields` scope.

name
    Name of the field(s) to select.
)Ú
isinstanceÚstrr   ÚplrÚfieldŠÚnames    ÚhC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\polars/functions/lazy.pyr7   r7   <   s+    ô $×ŃŘvÜSYYt_Ó%Đ%ó    c                 ó.    [         R                  " S5      $ )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Š r;   r:   ÚelementrA   H   s    ôH 559Đr;   c                 óŽ    U (       d.  [        SSS9  [        R                  " 5       R                  S5      $ [        R                  " U 6 R                  5       $ )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?   rE   ŠÚcolumnss    r:   rE   rE      sD    öH Ü!ŘHŘň	
ô uuw}}WÓ%Đ%Ü55'?× Ń Ó"Đ"r;   FŠÚreversec                óB    [         R                  " U6 R                  U S9$ )u~  
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.with_columns(
...     ca=pl.cum_count("a"),
...     cb=pl.cum_count("b"),
... )
shape: (3, 4)
ââââââââŹâââââââŹââââââŹââââââ
â a    â b    â ca  â cb  â
â ---  â ---  â --- â --- â
â i64  â i64  â u32 â u32 â
ââââââââŞâââââââŞââââââŞââââââĄ
â 1    â 3    â 1   â 1   â
â 2    â null â 2   â 1   â
â null â null â 2   â 1   â
ââââââââ´âââââââ´ââââââ´ââââââ
rJ   )r>   r?   Ú	cum_count)rK   rI   s     r:   rM   rM   Ü   s     ô> 55'?×$Ń$¨WĐ$Đ5Đ5r;   c                 óD    [         R                  " U 6 R                  5       $ )ul  
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?   ÚimploderH   s    r:   rO   rO   ţ   s    ôP 55'?×"Ń"Ó$Đ$r;   é   c                óL    [         R                  " U 5      R                  U5      $ )uŐ  
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ŠÚcolumnÚddofs     r:   rR   rR   )  ó    ôH 55=×ŃTÓ"Đ"r;   c                óL    [         R                  " U 5      R                  U5      $ )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     r:   rX   rX   P  rV   r;   c                 óD    [         R                  " U 6 R                  5       $ )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?   ÚmeanrH   s    r:   rZ   rZ   w  s    ôX 55'?×ŃÓ!Đ!r;   c                 óD    [         R                  " U 6 R                  5       $ )uŇ  
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?   ÚmedianrH   s    r:   r\   r\   Ś  s    ôP 55'?×!Ń!Ó#Đ#r;   c                 óD    [         R                  " U 6 R                  5       $ )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_uniquerH   s    r:   r^   r^   Ń  s    ôP 55'?×#Ń#Ó%Đ%r;   c                 óD    [         R                  " U 6 R                  5       $ )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_uniquerH   s    r:   r`   r`   ü  s    ôR 55'?×*Ń*Ó,Đ,r;   c                 ó    U (       d#  [         R                  " 5       R                  5       $ [        R                  " U 6 R                  5       $ )u  
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 â
âââââââ´ââââââ

)ÚcsÚfirstÚas_exprr>   r?   rH   s    r:   rc   rc   (  s4    öv Üxxz×!Ń!Ó#Đ#ä55'?× Ń Ó"Đ"r;   c                 ó    U (       d#  [         R                  " 5       R                  5       $ [        R                  " U 6 R                  5       $ )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 â
âââââââ´ââââââ

)rb   Úlastrd   r>   r?   rH   s    r:   rf   rf   i  s4    öv Üwwy× Ń Ó"Đ"ä55'?×ŃÓ!Đ!r;   T)Ústrictc                óJ    [         R                  " USU 06R                  5       $ )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   â
âââââââ´ââââââ
Úrequire_all)rb   Úby_indexrd   )rg   Úindicess     r:   Únthrl   Ş  s"    ôR ;;Đ4¨VŃ4×<Ń<Ó>Đ>r;   c                óL    [         R                  " U 5      R                  U5      $ )uŤ  
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ŠrT   Úns     r:   rn   rn   Ö  ó    ôX 55=×ŃaÓ Đ r;   c                óL    [         R                  " U 5      R                  U5      $ )uŞ  
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?   Útailro   s     r:   rs   rs     rq   r;   .)ÚmethodrU   Úpropagate_nansÚeagerc               ó    g ŠNr@   ŠÚaÚbrt   rU   ru   rv   s         r:   Úcorrr|   4  s    đ r;   )rt   rU   ru   c               ó    g rx   r@   ry   s         r:   r|   r|   @  s    đ r;   Úpearsonc          	     óŚ   Ub
  [        SSS9  U(       aÇ  [        U [        R                  5      (       d,  [        U[        R                  5      (       d  Sn[	        U5      e[        R
                  " X4 Vs/ s H&  n[        U[        R                  5      (       d  M$  UPM(     sn5      nS X4 5       n	UR                  [        U	SX$S.65      R                  5       $ [        U 5      n
[        U5      nUS:X  a  [        [        R                  " XŤ5      5      $ US	:X  a   [        [        R                  " XŤU5      5      $ S
U< 3n[	        U5      es  snf )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
]
z2the `ddof` parameter has no effect. Do not use it.z1.17.0rC   z=expected at least one Series in 'corr' inputs if 'eager=True'c              3  ó|   #    U  H2  n[        U[        R                  5      (       a  UR                  OUv   M4     g 7frx   Šr4   Úplr)   r9   ŠÚ.0Úes     r:   Ú	<genexpr>Úcorr.<locals>.<genexpr>Ź  ó)   é  ĐMÂfŔJ qŹ"Ż)Š)×4Ń4!&&¸!Ô;Âfůó   :<F)rv   rt   ru   r~   Úspearmanz3method must be one of {'pearson', 'spearman'}, got )r   r4   r   r)   Ú
ValueErrorr&   Úselectr|   Ú	to_seriesr   r   r6   Úpearson_corrÚspearman_rank_corr)rz   r{   rt   rU   ru   rv   Úmsgr   ÚframeÚexprsÚa_pyexprÚb_pyexprs               r:   r|   r|   L  s   đh ŃÜ!Ř@Řň	
ö
 Ü1bii×(Ń(ŹJ°qź"ż)š)×,DŃ,DŘQCÜS/Đ!ä¨!ŠÓLŞ A´:¸aÄÇÁ×3KaŠŃLÓMŮMŔqÁfÓMŘ||Ü%u¨VŇSó
ç
)+đ	ô )¨Ó+Ü(¨Ó+ŕYÓÜS×-Ň-¨hÓAÓBĐBŘzÓ!ÜS×3Ň3°HČÓWÓXĐXŕIČ&ÉĐTCÜS/Đ!ůň Ms   Á5#EÂE)rU   rv   c               ó    g rx   r@   Šrz   r{   rU   rv   s       r:   Úcovr   ˝  s    đ r;   )rU   c               ó    g rx   r@   r   s       r:   r   r   Ç  s    đ r;   c          	     ó   U(       aÇ  [        U [        R                  5      (       d,  [        U[        R                  5      (       d  Sn[        U5      e[        R                  " X4 Vs/ s H&  n[        U[        R                  5      (       d  M$  UPM(     sn5      nS X4 5       nUR                  [        USUS.65      R                  5       $ [        U 5      n[        U5      n	[        [        R                  " XU5      5      $ s  snf )ue  
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              3  ó|   #    U  H2  n[        U[        R                  5      (       a  UR                  OUv   M4     g 7frx   r   r   s     r:   r   Úcov.<locals>.<genexpr>  r   r   F)rv   rU   )r4   r   r)   r   r&   r   r   r   r   r   r6   )
rz   r{   rU   rv   r   r   r   r   r   r   s
             r:   r   r   Ń  sÁ    öv Ü1bii×(Ń(ŹJ°qź"ż)š)×,DŃ,DŘPCÜS/Đ!ä¨!ŠÓLŞ A´:¸aÄÇÁ×3KaŠŃLÓMŮMŔqÁfÓMŘ||C ¨e¸$Ň?Ó@×JŃJÓLĐLä(¨Ó+Ü(¨Ó+Ü °TÓ:Ó;Đ;ůň Ms   Á(#DÂDc                  óD    \ rS rSr      SS jr        SS jrSrg)Ú_map_batches_wrapperi  c               ó    Xl         X l        g rx   ŠÚfunctionÚreturns_scalar)Úselfr    rĄ   s      r:   Ú__init__Ú_map_batches_wrapper.__init__  s    đ !Ř,Őr;   c                ó   US   nU Vs/ s H  n[        U5      PM     nn U R                  " U/UQ70 UD6n[        U5      (       a3  [        U[        R                  5      (       a  [        R                  " XtS9n[        U[        R                  5      (       a  UR                  $ U R                  (       a   [        R                  " U/US9R                  $ S[        U5      < S3n	[        U	5      es  snf ! [         aF  nSUR                  S   ;   a-  UR	                  S5        U R                  " U/UQ70 UD6n S nAGN	e S nAff = f)NÚreturn_dtypez*unexpected keyword argument 'return_dtype'r   ŠÚdtypez>`map` with `returns_scalar=False` must return a Series; found zP.

If `returns_scalar` is set to `True`, a returned value can be a scalar value.)r   r    Ú	TypeErrorÚargsÚpopr   r4   ÚnpÚndarrayr   r)   Ú_srĄ   r   )
r˘   ÚslrŞ   ÚkwargsrŚ   ÚsÚslpÚrvr   r   s
             r:   Ú__call__Ú_map_batches_wrapper.__call__$  s    đ nŃ-Ů"$Ó%˘"QvayĄ"Đ%đ	ŘsĐ4 TŇ4¨VŃ4Bô B×Ń¤J¨r´2ˇ:ą:×$>Ń$>Ü2Ń2Bäb"))×$Ń$Ř55LŘ× × Ü99bT¨Ń6×9Ń9Đ9ŕRÔSfĐgiÓSjŃRmđ  n@đ  ACÜC.Đ ůň+ &řô
 ó 	Ř;¸qżvšvŔašyÓHŘ

>Ô*Ř]] 3Đ8¨Ň8°Ń8ŕűđ	ús"   C2˘C7 Ă7
EÄ:EĹEĹEr   N)r    ú*Callable[[Sequence[Series]], Series | Any]rĄ   ÚboolÚreturnÚNone)rŻ   zlist[plr.PySeries]rŞ   r   r°   r   r¸   úplr.PySeries)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rŁ   r´   Ú__static_attributes__r@   r;   r:   r   r     sH    đ-ŕ<đ-đ đ	-đ
 
ô-đ!Ř$đ!Ř-0đ!Ř<?đ!ŕ	÷!r;   r   ŠÚis_elementwiserĄ   c          
     ó    [        U 5      nUb  [        U5      R                  OSn[        [        R
                  " U[        XS9UUUS95      $ )u  
Map a custom function over multiple columns/expressions.

Produces a single Series result.

.. 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.
return_dtype
    Datatype of the output Series.

    It is recommended to set this whenever possible. If this is `None`, it tries
    to infer the datatype by calling the function with dummy data and looking at
    the output.
is_elementwise
    Set to true if the operations is elementwise for better performance
    and optimization.

    An elementwise operations has unit or equal length for all inputs
    and can be ran sequentially on slices without results being affected.
returns_scalar
    If the function returns a scalar, by default it will be wrapped in
    a list in the output, since the assumption is that the function
    always returns something Series-like. If you want to keep the
    result as a scalar, set this argument to True.

Notes
-----
A UDF passed to `map_batches` must be pure, meaning that it cannot modify
or depend on state other than its arguments. We may call the function
with arbitrary input data.

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    â
âââââââ´ââââââ´ââââââââ
N)rĄ   rŔ   )r   r   Ú_pydatatype_exprr   r6   Úmap_exprr   )r   r    rŚ   rÁ   rĄ   ÚpyexprsÚreturn_dtype_exprs          r:   Úmap_batchesrÇ   @  s^    ôd -¨UÓ3Gđ Ń#ô 	! Ó.×?Ň?ŕđ ô ÜŘÜ  ŃIŘŘ)Ř)ń	
óđ r;   c               ó    [        U UUUUS9$ )u9  
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
    Datatype of the output Series.

    It is recommended to set this whenever possible. If this is `None`, it tries
    to infer the datatype by calling the function with dummy data and looking at
    the output.
is_elementwise
    Set to true if the operations is elementwise for better performance
    and optimization.

    An elementwise operations has unit or equal length for all inputs
    and can be ran sequentially on slices without results being affected.
returns_scalar
    If the function returns a single scalar as output.

Notes
-----
A UDF passed to `map_batches` must be pure, meaning that it cannot modify
or depend on state other than its arguments. Polars may call the function
with arbitrary input data.

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]`
rŔ   )rÇ   )r   r    rŚ   rÁ   rĄ   s        r:   Ú
map_groupsrÉ   Ľ  s!    ô| ŘŘŘŘ%Ř%ńđ r;   )Ú	unorderedÚ
descendingÚ
nulls_lastc               óv   [        U [        R                  5      (       a  U R                  5       /n O"[        U [        R                  5      (       a  U /n [        U 5      nU(       a*  Ub   eUb   e[        R                  R                  U5      nO [        R                  R                  XBU5      n[        U5      $ rx   )r4   r   ÚSelectorrd   r'   r   r6   ÚPyExprÚrow_encode_unorderedÚrow_encode_orderedr   )r   rĘ   rË   rĚ   rĹ   Úresults         r:   Ú_row_encoderÓ     s    ô %×%Ń%ŘĐ!Ü	E277×	#Ń	#Řä,¨UÓ3GćŘŃ!Đ!Đ!ŘŃ!Đ!Đ!ä×0Ń0°Ó9ä×.Ń.¨wŔJÓOäVÓĐr;   c                ó   ^  SU 4S jjnU$ )Nc                óV   > U u  pT" [        U5      [        U5      5      R                  $ rx   )r   rŽ   )Útrz   r{   r    s      r:   ÚwrapperÚ _wrap_acc_lamba.<locals>.wrapper(  s%   ř ŘŮq	¤6¨!Ł9Ó-×0Ń0Đ0r;   )rÖ   z!tuple[plr.PySeries, plr.PySeries]r¸   rş   r@   )r    r×   s   ` r:   Ú_wrap_acc_lambarŮ   %  s   ř ÷1đ Nr;   ŠrĄ   rŚ   c          
     óř    [        U SS9n[        U[        R                  5      (       a  U/nSnUb  [	        U5      R
                  n[        U5      n[        [        R                  " U[        U5      UUUS95      $ )ul	  
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 â
â --- â
â i32 â
âââââââĄ
â 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_litNrÚ   )r   r4   r   r'   r   rĂ   r   r   r6   ÚfoldrŮ   )Úaccr    r   rĄ   rŚ   ÚpyaccÚrtrĹ   s           r:   rŢ   rŢ   /  s{    ô\ " #°$Ń7EÜ%×!Ń!Řŕ$(BŘŃÜ% lÓ3×DŃDä,¨UÓ3GÜÜŘÜHÓ%ŘŘ)Řń	
óđ r;   c          	     óâ    [        U[        R                  5      (       a  U/nSnUb  [        U5      R                  n[        U5      n[        [        R                  " [        U 5      UUUS95      $ )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.
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 input
    expressions.

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   â
âââââââ
NrÚ   )
r4   r   r'   r   rĂ   r   r   r6   ÚreducerŮ   Šr    r   rĄ   rŚ   rá   rĹ   s         r:   ră   ră   ą  sl    ôB %×!Ń!Řŕ$(BŘŃÜ% lÓ3×DŃDä,¨UÓ3GÜÜ

ÜHÓ%ŘŘ)Řń		
óđ r;   ŠrĄ   rŚ   Úinclude_initc               ó   [        U SS9n[        U[        R                  5      (       a  U/nSnUb  [	        U5      R
                  n[        U5      n[        [        R                  " U[        U5      UUUUS9R                  S5      5      $ )uą  
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.
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.
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Ü   Nrĺ   Úcum_fold)r   r4   r   r'   r   rĂ   r   r   r6   rč   rŮ   rG   )	rß   r    r   rĄ   rŚ   rć   rŕ   rá   rĹ   s	            r:   rč   rč     s    ô| " #°$Ń7EÜ%×!Ń!Řŕ$(BŘŃÜ% lÓ3×DŃDä,¨UÓ3GÜÜŘÜHÓ%ŘŘ)ŘŘ%ń	
÷ %
Ó
ó	đ 	r;   c          	     ó    [        U[        R                  5      (       a  U/nSnUb  [        U5      R                  n[        U5      n[        [        R                  " [        U 5      UUUS9R                  S5      5      $ )u8  
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.
return_dtype
    Output datatype.
    If not set, the dtype will be inferred based on the dtype of the input
    expressions.
include_init
    Include the initial accumulator state as struct field.

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}   â
âââââââ´ââââââ´ââââââ´âââââââââââââ
NrÚ   Ú
cum_reduce)r4   r   r'   r   rĂ   r   r   r6   rę   rŮ   rG   rä   s         r:   rę   rę   W  sx    ô` %×!Ń!Řŕ$(BŘŃÜ% lÓ3×DŃDä,¨UÓ3GÜÜÜHÓ%ŘŘ)Řń		
÷
 %Ó
óđ r;   c                óÂ   [        U [        5      (       a  [        R                  " U 5      n [        U[        5      (       a  [        R                  " U5      n[	        US5      (       d  S[        U5       S3n[        U5      e[	        U S5      (       d  S[        U 5       S3n[        U5      e[        [        R                  " U R                  UR                  5      5      $ )ue  
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 `Ú`)r4   r5   r>   r?   Úhasattrr   rŠ   r   r6   Úarctan2rě   )ÚyÚxr   s      r:   rď   rď     sł    ôH !S×ŃÜEE!HÜ!S×ŃÜEE!HÜ1i× Ń Ř<Ô=PĐQRÓ=SĐ<TĐTUĐVÜnĐÜ1i× Ń Ř<Ô=PĐQRÓ=SĐ<TĐTUĐVÜnĐäS[[ §Ą¨AŻIŠIÓ6Ó7Đ7r;   zI`arctan2d` is deprecated; use `arctan2` followed by `.degrees()` instead.c                ó4    [        X5      R                  5       $ )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     r:   Úarctan2drô   Ë  s    ôV 1=× Ń Ó"Đ"r;   c                óP    [         R                  " S5      R                  " U /UQ76 $ )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)rI   Úmore_columnss     r:   r÷   r÷   ů  s#    ôL 55:×ŇgĐ5¨Ň5Đ5r;   c                óJ    [         R                  " U 5      R                  5       $ )z1Syntactic sugar for `pl.col("foo").agg_groups()`.)r>   r?   Ú
agg_groups)rT   s    r:   Úgroupsrű   B  s    ä55=×#Ń#Ó%Đ%r;   c                óL    [         R                  " U 5      R                  X5      $ )zü
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?   Úquantile)rT   rý   Úinterpolations      r:   rý   rý   G  s    ô" 55=×!Ń! (Ó:Đ:r;   )rË   rĚ   ÚmultithreadedÚmaintain_orderc          	     ó¸    [        U /UQ76 n [        U[        U 5      SS5      n[        U[        U 5      SS5      n[        [        R
                  " XX#U5      5      $ )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   rF   r   r6   Úarg_sort_by)r   rË   rĚ   r˙   r   Ú
more_exprss         r:   r  r  [  sY    ôp +¨5Đ>°:Ň>EÜZŹ¨UŤ°\Ŕ7ÓKJÜZŹ¨UŤ°\Ŕ7ÓKJÜÜ¨:ŔnÓUóđ r;   Ú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Úenginec               óę    US:X  a  [        S5        U  Vs/ s H  oÝR                  PM     nn[        R                  " XěUR                  5      nU Vs/ s H  n[        U5      PM     nnU$ s  snf s  snf )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.

Ú	streamingú&streaming mode is considered unstable.)r   Ú_ldfr6   Úcollect_allÚ_pyoptflagsr   )Úlazy_framesr  r  r  r  r	  r
  r  r  r  r  r  r  ÚlfÚlfsÚoutÚpydfrŇ   s                     r:   r  r  ť  sk    đR ÓÜĐGÔHá(Ó
)[r77[CĐ
)Ü
//# }×'@Ń'@Ó
ACń ),Ó,Ş gdmŠFĐ,ŕMůň *ůň -s   A+ÁA0)r  r  c               ó    g rx   r@   Šr  Úgeventr  r  s       r:   Úcollect_all_asyncr  0  s    đ /2r;   )r  r  r  c               ó    g rx   r@   r  s       r:   r  r  :  s    đ "%r;   c               óö    US:X  a  [        S5        U(       a
  [        5       O	[        5       nU  Vs/ s H  oUR                  PM     nn[        R
                  " XbUR                  UR                  5        U$ s  snf )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  )r   r	   r   r  r6   Úcollect_all_with_callbackr  Ú_callback_all)r  r  r  r  rŇ   r  r  s          r:   r  r  D  sq    đB ÓÜĐGÔHö %+ÔÔ Ô0CÓ0Eđ ń )Ó
)[r77[CĐ
)Ü×!Ň!Ř]×.Ń.°×0DŃ0Dôđ Můň	 *s   ąA6)r  c               ó    U  Vs/ s H  o"R                   PM     nn[        R                  " X1R                  5      $ s  snf )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.
)r  r6   Úexplain_allr  )r  r  r  r  s       r:   r%  r%    s4    ń6 )Ó
)[r77[CĐ
)Ü??3× 9Ń 9Ó:Đ:ůň *s   <Šrv   c                ó    g rx   r@   Šrv   r   Únamed_exprss      r:   r   r   ą  ó    đ
 r;   c                ó    g rx   r@   r(  s      r:   r   r   š  r*  r;   c                ó    U (       a  [         R                  " 5       O[         R                  " 5       nUR                  " U0 UD6$ )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   )rv   r   r)  Úempty_frames       r:   r   r   Á  s0    öt %*",,.ŹrŻ|Ş|Ť~KŘ×ŇuĐ4¨Ń4Đ4r;   c               ó    g rx   r@   ŠÚ	conditionrv   s     r:   Ú	arg_wherer1  ˙  s    ŘQTr;   c               ó    g rx   r@   r/  s     r:   r1  r1  	  ó    ŘLOr;   c               ó   U(       a  [        U [        R                  5      (       d$  S[        U 5      R                  < 3n[        U5      eU R                  5       R                  [        [        R                  " U R                  5      5      5      R                  5       $ [        U 5      n[        [        R                  " U5      5      $ )aK  
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 )r4   r   r)   Útyperť   r   Úto_framer   r1  r>   r?   r9   r   r   r   r6   )r0  rv   r   Úcondition_pyexprs       r:   r1  r1  	  s    ö@ Ü)¤R§YĄY×/Ń/đÜO×,Ń,Ń/đ1đ ô S/Đ!Ř×!Ń!Ó#×*Ń*Ź9´QˇU˛U¸9ż>š>Ó5JÓ+KÓL×VŃVÓXĐXä0°Ó;ĐÜĐ'7Ó8Ó9Đ9r;   c               ó    g rx   r@   Šr   rv   r  s      r:   Úcoalescer:  4	  s    đ
 r;   c               ó    g rx   r@   r9  s      r:   r:  r:  <	  s    đ
 r;   c               ó    g rx   r@   r9  s      r:   r:  r:  D	  s    đ
 r;   c               ó   U(       aĹ  U /UQn U  Vs/ s H&  n[        U[        R                  5      (       d  M$  UPM(     sn=n(       d  Sn[        U5      eU  Vs/ s H0  n[        U[        R                  5      (       a  UR                  OUPM2     n n[        R
                  " U5      R                  [        U SS95      R                  5       $ [        U /UQ76 n [        [        R                  " U 5      5      $ s  snf s  snf )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
]
z:expected at least one Series in 'coalesce' if 'eager=True'Fr&  )r4   r   r)   r   r9   r&   r   r:  r   r   r   r6   )r   rv   r  r   Úseriesr   s         r:   r:  r:  L	  sŃ    öF ŘĐ$Đ$Ů&+ÓH˘e Źz¸!źRżYšY×/G1ĄeŃHĐHŐHŘNCÜS/Đ!áFKÓLÂeŔJ qŹ"Ż)Š)×4Ń4!&&¸!Ň;ÁeĐLÜ||FÓ#×*Ń*Ź8°EŔŃ+GÓH×RŃRÓTĐTä.¨uĐB°zŇBÜ eÓ,Ó-Đ-ůň Iůň Ms   #C8¸C8Á7C=c                ó    g rx   r@   ŠrT   Ú	time_units     r:   Ú
from_epochrB  	  r3  r;   c                ó    g rx   r@   r@  s     r:   rB  rB   	  s    đ r;   c                óđ   [        U [        5      (       a  [        R                  " U 5      n OE[        U [        R
                  [        R                  45      (       d  [        R
                  " U 5      n US:X  a  U R                  [        5      $ US:X  a0  U R                  [        5      S-  R                  [        S5      5      $ U[        ;   a  U R                  [        U5      5      $ SU< 3n[        U5      e)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
]
Údrą   i@B Úusz=`time_unit` must be one of {'ns', 'us', 'ms', 's', 'd'}, got )r4   r5   r>   r?   r   r)   r'   Úcastr   r   r   r   r   )rT   rA  r   s      r:   rB  rB  Ś	  s˝    ô\ &#×ŃÜvÜ¤§ĄŹBŻGŠGĐ 4×5Ń5Ü6Ó"ŕCÓŘ{{4Ó Đ Ř	cÓ	ŘEÓ" YŃ.×4Ń4´X¸dł^ÓDĐDŘ	Ô*Ó	*Ř{{8 IÓ.Ó/Đ/ŕOĐPYÉ}Đ]ÜoĐr;   Úmin_periodsÚmin_samplesz1.21.0rC   )rI  rU   c          	     ó$   Uc  Un[        U [        5      (       a  [        R                  " U 5      n [        U[        5      (       a  [        R                  " U5      n[	        [
        R                  " U R                  UR                  X#U5      5      $ )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.
)r4   r5   r>   r?   r   r6   Úrolling_covrě   Šrz   r{   Úwindow_sizerI  rU   s        r:   rK  rK  ä	  sk    đB ŃŘ!Ü!S×ŃÜEE!HÜ!S×ŃÜEE!HÜÜ		 1§9Ą9¨kČÓMóđ r;   c          	     ó$   Uc  Un[        U [        5      (       a  [        R                  " U 5      n [        U[        5      (       a  [        R                  " U5      n[	        [
        R                  " U R                  UR                  X#U5      5      $ )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.
)r4   r5   r>   r?   r   r6   Úrolling_corrrě   rL  s        r:   rO  rO  
  sm    đB ŃŘ!Ü!S×ŃÜEE!HÜ!S×ŃÜEE!HÜÜ×Ň A§IĄI¨{ČÓNóđ r;   c                ó    g rx   r@   ŠÚsqls    r:   Úsql_exprrS  <
  s    ŕr;   c                ó    g rx   r@   rQ  s    r:   rS  rS  A
  s    Ř03r;   c                óÔ    [        U [        5      (       a  [        [        R                  " U 5      5      $ U  Vs/ s H"  n[        [        R                  " U5      5      PM$     sn$ s  snf )uo  
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     â
âââââââ´ââââââ´ââââââââ
)r4   r5   r   r6   rS  )rR  Úqs     r:   rS  rS  E
  sK    ôP #s×ŃÜ cÓ*Ó+Đ+á47Ó8˛C¨q	#,, q/Ö*ąCŃ8Đ8ůŇ8s   š)A%c                ó    [         R                  " [         R                  " 5       [        5       S9R	                  U 5      $ )uË  
Generates a sequence of integers.

The length of the returned sequence will match the context length, and the
datatype will match the one returned by `get_index_dtype()`.

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

If you would like to generate sequences with custom offsets / length /
step size / datatypes, it is recommended to use `int_range` instead.

Parameters
----------
name
    Name of the returned column.

Returns
-------
Expr
    Column of integers.

See Also
--------
int_range : Generate a range of integers.

Examples
--------
>>> df = pl.DataFrame({"x": ["A", "A", "B", "B", "B"]})
>>> df.with_columns(pl.row_index(), pl.row_index("another_index"))
shape: (5, 3)
âââââââŹââââââââŹââââââââââââââââ
â x   â index â another_index â
â --- â ---   â ---           â
â str â u32   â u32           â
âââââââŞââââââââŞââââââââââââââââĄ
â A   â 0     â 0             â
â A   â 1     â 1             â
â B   â 2     â 2             â
â B   â 3     â 3             â
â B   â 4     â 4             â
âââââââ´ââââââââ´ââââââââââââââââ
>>> df.group_by("x").agg(pl.row_index()).sort("x")
shape: (2, 2)
âââââââŹââââââââââââ
â x   â index     â
â --- â ---       â
â str â list[u32] â
âââââââŞââââââââââââĄ
â A   â [0, 1]    â
â B   â [0, 1, 2] â
âââââââ´ââââââââââââ
>>> df.select(pl.row_index())
shape: (5, 1)
âââââââââ
â index â
â ---   â
â u32   â
âââââââââĄ
â 0     â
â 1     â
â 2     â
â 3     â
â 4     â
âââââââââ
r§   )r>   Ú	int_rangerF   r    rG   r8   s    r:   Ú	row_indexrY  s
  s0    ôR ;;Ü	ÜÓń÷ eDkđr;   )r9   zstr | list[str]r¸   r'   )r¸   r'   )rI   r5   r¸   r'   )rI   r5   rK   rˇ   r¸   r'   )rP   )rT   r5   rU   Úintr¸   r'   )rk   zint | Sequence[int]rg   rˇ   r¸   r'   )é
   )rT   r5   rp   rZ  r¸   r'   )rz   r-   r{   r-   rt   r*   rU   ú
int | Noneru   rˇ   rv   úLiteral[False]r¸   r'   )rz   r-   r{   r-   rt   r*   rU   r\  ru   rˇ   rv   úLiteral[True]r¸   r)   )rz   r-   r{   r-   rt   r*   rU   r\  ru   rˇ   rv   rˇ   r¸   úExpr | Series)
rz   r-   r{   r-   rU   rZ  rv   r]  r¸   r'   )
rz   r-   r{   r-   rU   rZ  rv   r^  r¸   r)   )
rz   r-   r{   r-   rU   rZ  rv   rˇ   r¸   r_  rx   )r   zSequence[str | Expr]r    rś   rŚ   z'PolarsDataType | pl.DataTypeExpr | NonerÁ   rˇ   rĄ   rˇ   r¸   r'   )
r   z/pl.Selector | pl.Expr | Sequence[str | pl.Expr]rĘ   rˇ   rË   úlist[bool] | NonerĚ   r`  r¸   r'   )r    ú"Callable[[Series, Series], Series]r¸   z;Callable[[tuple[plr.PySeries, plr.PySeries]], plr.PySeries])rß   r-   r    ra  r   úSequence[Expr | str] | ExprrĄ   rˇ   rŚ   ú'pl.DataTypeExpr | PolarsDataType | Noner¸   r'   )
r    ra  r   rb  rĄ   rˇ   rŚ   rc  r¸   r'   )rß   r-   r    ra  r   rb  rĄ   rˇ   rŚ   rc  rć   rˇ   r¸   r'   )rđ   ú
str | Exprrń   rd  r¸   r'   )rI   zCstr | PolarsDataType | Collection[str] | Collection[PolarsDataType]rř   zstr | PolarsDataTyper¸   r'   )rT   r5   r¸   r'   )Únearest)rT   r5   rý   zfloat | Exprrţ   r/   r¸   r'   )r   úIntoExpr | Iterable[IntoExpr]r  r-   rË   úbool | Sequence[bool]rĚ   rg  r˙   rˇ   r   rˇ   r¸   r'   )r  úIterable[LazyFrame]r  rˇ   r  rˇ   r  rˇ   r  rˇ   r	  rˇ   r
  rˇ   r  rˇ   r  rˇ   r  rˇ   r  rˇ   r  r0   r  r+   r¸   zlist[DataFrame])
r  rh  r  r^  r  r+   r  r0   r¸   z'_GeventDataFrameResult[list[DataFrame]])
r  rh  r  r]  r  r+   r  r0   r¸   zAwaitable[list[DataFrame]])
r  rh  r  rˇ   r  r+   r  r0   r¸   zDAwaitable[list[DataFrame]] | _GeventDataFrameResult[list[DataFrame]])r  rh  r  r0   r¸   r5   )r   rf  rv   r^  r)  r-   r¸   r&   )r   rf  rv   r]  r)  r-   r¸   r(   )r   rf  rv   rˇ   r)  r-   r¸   zDataFrame | LazyFrame)r0  r_  rv   r]  r¸   r'   )r0  r_  rv   r^  r¸   r)   )r0  r_  rv   rˇ   r¸   r_  )r   rf  r  r-   rv   r]  r¸   r'   )r   rf  r  r-   rv   r^  r¸   r)   )r   rf  r  r-   rv   rˇ   r¸   r_  ).)rT   rd  rA  r,   r¸   r'   )rT   zSeries | Sequence[int]rA  r,   r¸   r)   )rą   )rT   z#str | Expr | Series | Sequence[int]rA  r,   r¸   r_  )rz   rd  r{   rd  rM  rZ  rI  r\  rU   rZ  r¸   r'   )rR  r5   r¸   r'   )rR  zSequence[str]r¸   z
list[Expr])rR  zstr | Sequence[str]r¸   zExpr | list[Expr])Úindex)r9   r5   r¸   zpl.Expr)~Ú
__future__r   Ú
contextlibÚtypingr   r   r   r   Úpolars._reexportÚ	_reexportr   Úpolars.functionsÚ	functionsr>   Úpolars.selectorsÚ	selectorsrb   Ú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   r   Úpolars.datatypesr   r   r   r   Úpolars.datatypes._parser   Úpolars.dependenciesr   r   rŹ   Úpolars.lazyframe.opt_flagsr   r   Úpolars.meta.index_typer    ÚsuppressÚImportErrorÚpolars._plrÚ_plrr6   ÚsysÚcollections.abcr!   r"   r#   r$   r%   Úpolarsr&   r'   r(   r)   Úpolars._typingr*   r+   r,   r-   r.   r/   r0   Úversion_infoÚwarningsÚtyping_extensionsr7   rA   rE   rM   rO   rR   rX   rZ   r\   r^   r`   rc   rf   rl   rn   rs   r|   r   r   rÇ   rÉ   rÓ   rŮ   rŢ   ră   rč   rę   rď   rô   r÷   rű   rý   r  r  r  r%  r   r1  r:  rB  rK  rO  rS  rY  r@   r;   r:   Ú<module>r     sN  đÝ "ă ß 9Ó 9ĺ Ý Ý ß L÷ó ÷÷ Dß Bß 9Ń 9ß HÓ HÝ <Ý 0Ý +÷ő 2ŕ×ŇŐ%Ý÷ &ö ŰßIÓIÝç9Ó9÷÷ őđ ×Ń7Ó"Ţ'ĺ0ô	&ôDôNJ#đZ .3÷ 6ôD(%öV$#öN$#ôN,"ô^($ôV(&ôV)-ôX>#ôB>"đB 7;÷ )?öX,!ö^,!đ^ 
đ
 !$ŘŘŘńŘđŕđđ đ	đ
 đđ đđ đđ 
ôó 
đđ 
đ
 !$ŘŘńŘđŕđđ đ	đ
 đđ đđ đđ ôó 
đđ !*ŘŘ Řńn"Řđn"ŕđn"đ đ	n"đ
 đn"đ đn"đ đn"đ őn"đb 
đ
 ŘńŘđŕđđ đ	đ
 đđ 
ôó 
đđ 
đ
 ń	Řđŕđđ đ	đ
 đđ ôó 
đđ ŘńF<ŘđF<ŕđF<đ đ	F<đ
 đF<đ őF<÷R#!ń #!đR =Ađbđ
 !Ř ńbŘđbŕ8đbđ :đbđ
 đbđ đbđ 
öbđP =Ađdđ
 !Ř ńdŘđdŕ8đdđ :đdđ
 đdđ đdđ 
ödđT Ř$(Ř$(ńŘ:đđ đđ "đ	đ
 "đđ 
őđ2Ř0đŕ@ôđ !Ř<@ńŘ	đŕ0đđ 'đđ
 đđ :đđ 
őđL !Ř<@ńPŘ0đPŕ&đPđ đ	Pđ
 :đPđ 
őPđp !Ř<@ŘńPŘ	đPŕ0đPđ 'đPđ
 đPđ :đPđ đPđ 
őPđn !Ř<@ń?Ř0đ?ŕ&đ?đ đ	?đ
 :đ?đ 
ő?ôD/8ńd ĐWÓXó*#ó Yđ*#đZF6ŘPđF6ŕ'đF6đ 
ôF6ôR&đ %.đ;Řđ;ŕđ;đ "đ;đ 
ő	;đ. ).Ř(-ŘŘ ń]Ř(đ]ŕđ]đ &đ]đ &đ	]đ
 đ]đ đ]đ 
ő]ń@ Ó ŮÓđ Ř#Ř $Ř $Ř!ŘŘ"Ř"Ř!%ŘŘ#:ŘńpŘ$đpđ đpđ đ	pđ
 đpđ đpđ đpđ đpđ đpđ đpđ đpđ đpđ !đpđ đpđ ôpó ó !đpđf 
đ
  Ř#:ń2Ř$đ2đ đ2đ đ	2đ
 !đ2đ -ô2ó 
đ2đ 
đ #ŘŘ#:ń%Ř$đ%đ đ%đ đ	%đ
 !đ%đ  ô%ó 
đ%ń 
ŮÓ đ ŘŘ#:ńIŘ$đIđ đIđ đ	Iđ
 !đIđ JôIó !ó đIńX 
đ $;ń;Ř$đ;đ !đ;đ 	ô	;ó đ;đ< 
đ ńŘ)đŕđđ đđ ô	ó 
đđ 
đŘ)đŕđđ đđ ó	ó 
đđ :>ń;5Ř)đ;5Ř26đ;5ŘNVđ;5ŕő;5đ| 
ŘCFÖ Tó 
Ř Tđ 
Ű Oó 
Ř Ođ :?÷ *:đZ 
đ  ńŘ(đŕđđ đđ 
ô	ó 
đđ 
đŘ(đŕđđ đđ ó	ó 
đđ 
đŘ(đŕđđ đđ ó	ó 
đđ ńM.Ř(đM.ŕđM.đ đM.đ ő	M.đ` 
Ý Oó 
Ř Ođ 
ŕ?BđŘ"đŘ/<đŕôó 
đđ MPđ;Ř/đ;Ř<Iđ;ŕő;ń| ]¨MŔ8ŃLđ #Řń(Řđ(ŕđ(đ đ	(đ
 đ(đ đ(đ 
ô(ó Mđ(ńV ]¨MŔ8ŃLđ #Řń(Řđ(ŕđ(đ đ	(đ
 đ(đ đ(đ 
ô(ó Mđ(đV 
óó 
đđ 
Ű 3ó 
Ř 3ô+9ń\ 
őKó ńK÷gR &Ö%ús   ÂS Ó 
S/