ó
    œþöh³)  ã                  óH  • S SK Jr  S SKrS SKJr  S SKJr  S SKJ	r	  S SK
Jr  \R                  " \5         S SKJr  SSS5        \(       a  S SKJr  S SKJr  S SKJr  SS	 jrSS
 jrSS jrSS jrSS.     SS jjrSS.     SS jjrSS jrg! , (       d  f       N]= f)é    )ÚannotationsN)ÚTYPE_CHECKING)Úparse_into_list_of_expressions)Ú	wrap_expr)ÚIterable)ÚExpr)ÚIntoExprc                 óP   • [        U 6 n[        [        R                  " U5      5      $ )u€  
Compute the bitwise AND horizontally across columns.

Parameters
----------
*exprs
    Column(s) to use in the aggregation. Accepts expression input. Strings are
    parsed as column names, other non-expression inputs are parsed as literals.

Notes
-----
`Kleene logic`_ is used to deal with nulls: if the column contains any null values
and no `False` values, the output is null.

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

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [False, False, True, True, False, None],
...         "b": [False, True, True, None, None, None],
...         "c": ["u", "v", "w", "x", "y", "z"],
...     }
... )
>>> df.with_columns(all=pl.all_horizontal("a", "b"))
shape: (6, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a     â”† b     â”† c   â”† all   â”‚
â”‚ ---   â”† ---   â”† --- â”† ---   â”‚
â”‚ bool  â”† bool  â”† str â”† bool  â”‚
â•žâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•¡
â”‚ false â”† false â”† u   â”† false â”‚
â”‚ false â”† true  â”† v   â”† false â”‚
â”‚ true  â”† true  â”† w   â”† true  â”‚
â”‚ true  â”† null  â”† x   â”† null  â”‚
â”‚ false â”† null  â”† y   â”† false â”‚
â”‚ null  â”† null  â”† z   â”† null  â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”˜
)r   r   ÚplrÚall_horizontal©ÚexprsÚpyexprss     Úa/home/james-whalen/.local/lib/python3.13/site-packages/polars/functions/aggregation/horizontal.pyr   r      ó%   € ôR -¨eÐ4€GÜ”S×'Ò'¨Ó0Ó1Ð1ó    c                 óP   • [        U 6 n[        [        R                  " U5      5      $ )u~  
Compute the bitwise OR horizontally across columns.

Parameters
----------
*exprs
    Column(s) to use in the aggregation. Accepts expression input. Strings are
    parsed as column names, other non-expression inputs are parsed as literals.

Notes
-----
`Kleene logic`_ is used to deal with nulls: if the column contains any null values
and no `True` values, the output is null.

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

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [False, False, True, True, False, None],
...         "b": [False, True, True, None, None, None],
...         "c": ["u", "v", "w", "x", "y", "z"],
...     }
... )
>>> df.with_columns(any=pl.any_horizontal("a", "b"))
shape: (6, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a     â”† b     â”† c   â”† any   â”‚
â”‚ ---   â”† ---   â”† --- â”† ---   â”‚
â”‚ bool  â”† bool  â”† str â”† bool  â”‚
â•žâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•¡
â”‚ false â”† false â”† u   â”† false â”‚
â”‚ false â”† true  â”† v   â”† true  â”‚
â”‚ true  â”† true  â”† w   â”† true  â”‚
â”‚ true  â”† null  â”† x   â”† true  â”‚
â”‚ false â”† null  â”† y   â”† null  â”‚
â”‚ null  â”† null  â”† z   â”† null  â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”˜
)r   r   r   Úany_horizontalr   s     r   r   r   A   r   r   c                 óP   • [        U 6 n[        [        R                  " U5      5      $ )u   
Get the maximum value horizontally across columns.

Parameters
----------
*exprs
    Column(s) to use in the aggregation. Accepts expression input. Strings are
    parsed as column names, other non-expression inputs are parsed as literals.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 8, 3],
...         "b": [4, 5, None],
...         "c": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(max=pl.max_horizontal("a", "b"))
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ a   â”† b    â”† c   â”† max â”‚
â”‚ --- â”† ---  â”† --- â”† --- â”‚
â”‚ i64 â”† i64  â”† str â”† i64 â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ 1   â”† 4    â”† x   â”† 4   â”‚
â”‚ 8   â”† 5    â”† y   â”† 8   â”‚
â”‚ 3   â”† null â”† z   â”† 3   â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
)r   r   r   Úmax_horizontalr   s     r   r   r   n   ó$   € ô> -¨eÐ4€GÜ”S×'Ò'¨Ó0Ó1Ð1r   c                 óP   • [        U 6 n[        [        R                  " U5      5      $ )u   
Get the minimum value horizontally across columns.

Parameters
----------
*exprs
    Column(s) to use in the aggregation. Accepts expression input. Strings are
    parsed as column names, other non-expression inputs are parsed as literals.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 8, 3],
...         "b": [4, 5, None],
...         "c": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(min=pl.min_horizontal("a", "b"))
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ a   â”† b    â”† c   â”† min â”‚
â”‚ --- â”† ---  â”† --- â”† --- â”‚
â”‚ i64 â”† i64  â”† str â”† i64 â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ 1   â”† 4    â”† x   â”† 1   â”‚
â”‚ 8   â”† 5    â”† y   â”† 5   â”‚
â”‚ 3   â”† null â”† z   â”† 3   â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
)r   r   r   Úmin_horizontalr   s     r   r   r   ‘   r   r   T)Úignore_nullsc                óP   • [        U6 n[        [        R                  " X 5      5      $ )u  
Sum all values horizontally across columns.

Parameters
----------
*exprs
    Column(s) to use in the aggregation. Accepts expression input. Strings are
    parsed as column names, other non-expression inputs are parsed as literals.
ignore_nulls
    Ignore null values (default).
    If set to `False`, any null value in the input will lead to a null output.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 8, 3],
...         "b": [4, 5, None],
...         "c": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(sum=pl.sum_horizontal("a", "b"))
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ a   â”† b    â”† c   â”† sum â”‚
â”‚ --- â”† ---  â”† --- â”† --- â”‚
â”‚ i64 â”† i64  â”† str â”† i64 â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ 1   â”† 4    â”† x   â”† 5   â”‚
â”‚ 8   â”† 5    â”† y   â”† 13  â”‚
â”‚ 3   â”† null â”† z   â”† 3   â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
)r   r   r   Úsum_horizontal©r   r   r   s      r   r   r   ´   s%   € ôH -¨eÐ4€GÜ”S×'Ò'¨Ó>Ó?Ð?r   c                óP   • [        U6 n[        [        R                  " X 5      5      $ )u8  
Compute the mean of all values horizontally across columns.

Parameters
----------
*exprs
    Column(s) to use in the aggregation. Accepts expression input. Strings are
    parsed as column names, other non-expression inputs are parsed as literals.
ignore_nulls
    Ignore null values (default).
    If set to `False`, any null value in the input will lead to a null output.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 8, 3],
...         "b": [4, 5, None],
...         "c": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(mean=pl.mean_horizontal("a", "b"))
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”
â”‚ a   â”† b    â”† c   â”† mean â”‚
â”‚ --- â”† ---  â”† --- â”† ---  â”‚
â”‚ i64 â”† i64  â”† str â”† f64  â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•¡
â”‚ 1   â”† 4    â”† x   â”† 2.5  â”‚
â”‚ 8   â”† 5    â”† y   â”† 6.5  â”‚
â”‚ 3   â”† null â”† z   â”† 3.0  â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”˜
)r   r   r   Úmean_horizontalr   s      r   r   r   Ü   s%   € ôH -¨eÐ4€GÜ”S×(Ò(¨Ó?Ó@Ð@r   c                 óJ  • [        U 6 nU Vs/ s H  n[        U5      PM     nn[        R                  " [        R                  " S5      R                  [        R                  " [        R                  " [        U 5      5      5      5      S U5      R                  S5      $ s  snf )u   
Cumulatively sum all values horizontally across columns.

Parameters
----------
*exprs
    Column(s) to use in the aggregation. Accepts expression input. Strings are
    parsed as column names, other non-expression inputs are parsed as literals.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 8, 3],
...         "b": [4, 5, None],
...         "c": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(pl.cum_sum_horizontal("a", "b"))
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a   â”† b    â”† c   â”† cum_sum   â”‚
â”‚ --- â”† ---  â”† --- â”† ---       â”‚
â”‚ i64 â”† i64  â”† str â”† struct[2] â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•â•¡
â”‚ 1   â”† 4    â”† x   â”† {1,5}     â”‚
â”‚ 8   â”† 5    â”† y   â”† {8,13}    â”‚
â”‚ 3   â”† null â”† z   â”† {3,null}  â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜
r   c                ó
   • X-   $ )N© )ÚaÚbs     r   Ú<lambda>Ú$cum_sum_horizontal.<locals>.<lambda>(  s   € Q’Ur   Úcum_sum)
r   r   ÚFÚcum_foldÚlitÚcastÚdtype_ofr   ÚlistÚalias)r   r   ÚeÚexprs_wrappeds       r   Úcum_sum_horizontalr1     sz   € ô> -¨eÐ4€GÙ+2Ó3ª7 a”Y˜q–\©7€MÐ3ä:Š:Ü	Šˆa‹‰”a—j’j¤×!1Ò!1´$°u³+Ó!>Ó?Ó@ÙØó÷ eˆIÓð	ùò 4s   B )r   úIntoExpr | Iterable[IntoExpr]Úreturnr   )r   r2   r   Úboolr3   r   )Ú
__future__r   Ú
contextlibÚtypingr   Úpolars.functionsÚ	functionsr(   Úpolars._utils.parser   Úpolars._utils.wrapr   ÚsuppressÚImportErrorÚpolars._plrÚ_plrr   Úcollections.abcr   Úpolarsr   Úpolars._typingr	   r   r   r   r   r   r   r1   r"   r   r   Ú<module>rC      s´   ðÝ "ã Ý  å Ý >Ý (à×Ò˜Õ%Ý÷ &ö Ý(åÝ'ô*2ôZ*2ôZ 2ôF 2ðH AEñ%@Ø)ð%@Ø9=ð%@à	õ%@ðR AEñ%AØ)ð%AØ9=ð%Aà	õ%AõP&÷u &Õ%ús   µBÂ
B!