ó
    œþöh£—  ã                  óR  • S SK Jr  S SKJrJrJr  S SKJr  S SK	J
r
  S SKJr  \(       a`  S SKrS SKJr  S SKJr  S S	KJr  S S
KJrJrJrJrJrJr  \R4                  S:¼  a  S SKJr  OS SKJr  \R4                  S:¼  a  S SKJr  OS SKJr   " S S5      r " S S5      r " S S5      r g)é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚCallable)Ú	functions)Úparse_as_duration_string)Ú
deprecatedN)ÚIterable)Ú	timedelta)Ú	DataFrame)ÚClosedIntervalÚIntoExprÚLabelÚQuantileMethodÚ
SchemaDictÚStartBy)é   é   )ÚSelf)r   é   c                  ó(  • \ rS rSrSr          SS jrSS jrSS jr      SS jrSS jr	SSS jjr
SSS	 jjrS S
 jrS!S"S jjr\" S5      S S j5       rS S jrS S jrS S jrS S jrS S jrS S jrS S jr S#     S$S jjrS S jrSrg)%ÚGroupByé#   zStarts a new GroupBy operation.c               ó4   • Xl         X0l        X@l        X l        g)a:  
Utility class for performing a group by operation over the given DataFrame.

Generated by calling `df.group_by(...)`.

Parameters
----------
df
    DataFrame to perform the group by operation over.
*by
    Column or columns to group by. Accepts expression input. Strings are parsed
    as column names.
maintain_order
    Ensure that the order of the groups is consistent with the input data.
    This is slower than a default group by.
**named_by
    Additional column(s) to group by, specified as keyword arguments.
    The columns will be named as the keyword used.
N)ÚdfÚbyÚnamed_byÚmaintain_order)Úselfr   r   r   r   s        ÚS/home/james-whalen/.local/lib/python3.13/site-packages/polars/dataframe/group_by.pyÚ__init__ÚGroupBy.__init__&   s   € ð4 ŒØŒØ ŒØ,Õó    c                ó‚  • SSK Jn  U R                  R                  5       U l        SnU R                  R	                  5       R
                  " U R                  0 U R                  DSU R                  0D6R                  [        R                  " 5       R                  5       R                  U5      5      R                  UR                  5       S9nUR!                  [        R"                  " 5       R%                  U5      5      R'                  5       U l        UR!                  U5      R+                  5       U l        SU l        U $ )uK  
Allows iteration over the groups of the group by operation.

Each group is represented by a tuple of `(name, data)`. The group names are
tuples of the distinct group values that identify each group.

Examples
--------
>>> df = pl.DataFrame({"foo": ["a", "a", "b"], "bar": [1, 2, 3]})
>>> for name, data in df.group_by("foo"):  # doctest: +SKIP
...     print(name)
...     print(data)
(a,)
shape: (2, 2)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ foo â”† bar â”‚
â”‚ --- â”† --- â”‚
â”‚ str â”† i64 â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ a   â”† 1   â”‚
â”‚ a   â”† 2   â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
(b,)
shape: (1, 2)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ foo â”† bar â”‚
â”‚ --- â”† --- â”‚
â”‚ str â”† i64 â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ b   â”† 3   â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
r   ©ÚQueryOptFlagsÚ__POLARS_GB_GROUP_INDICESr   ©Úoptimizations)Úpolars.lazyframe.opt_flagsr&   r   ÚrechunkÚlazyÚgroup_byr   r   r   ÚaggÚFÚfirstÚ
agg_groupsÚaliasÚcollectÚnoneÚselectÚallÚexcludeÚ	iter_rowsÚ_group_namesÚ	to_seriesÚ_group_indicesÚ_current_index©r   r&   Útemp_colÚ	groups_dfs       r    Ú__iter__ÚGroupBy.__iter__E   só   € õD 	=à—'‘'—/‘/Ó#ˆŒØ.ˆàG‰GL‰L‹Nß‰XðØ—w‘wðUØ"&§-¡-ñUØ@D×@SÑ@SòUç‰S”—’“×%Ñ%Ó'×-Ñ-¨hÓ7Ó8ß‰W =×#5Ñ#5Ó#7ˆWÐ8ð	 	ð &×,Ñ,¬Q¯UªU«W¯_©_¸XÓ-FÓG×QÑQÓSˆÔØ'×.Ñ.¨xÓ8×BÑBÓDˆÔØˆÔàˆr#   c                ó  • U R                   [        U R                  5      :¼  a  [        e[	        U R
                  5      nU R                  U R                  U R                      S S 24   nU =R                   S-  sl         X4$ ©Né   ©r<   Úlenr;   ÚStopIterationÚnextr9   r   ©r   Ú
group_nameÚ
group_datas      r    Ú__next__ÚGroupBy.__next__x   óo   € Ø×Ñ¤# d×&9Ñ&9Ó":Ó:ÜÐä˜$×+Ñ+Ó,ˆ
Ø—W‘W˜T×0Ñ0°×1DÑ1DÑEÂqÐHÑIˆ
Ø×Ò˜qÑ ÕàÐ%Ð%r#   c                óü   • SSK Jn  U R                  R                  5       R                  " U R
                  0 U R                  DSU R                  0D6R                  " U0 UD6R                  UR                  5       S9$ )u  
Compute aggregations for each group of a group by operation.

Parameters
----------
*aggs
    Aggregations to compute for each group of the group by operation,
    specified as positional arguments.
    Accepts expression input. Strings are parsed as column names.
**named_aggs
    Additional aggregations, specified as keyword arguments.
    The resulting columns will be renamed to the keyword used.

Examples
--------
Compute the aggregation of the columns for each group.

>>> df = pl.DataFrame(
...     {
...         "a": ["a", "b", "a", "b", "c"],
...         "b": [1, 2, 1, 3, 3],
...         "c": [5, 4, 3, 2, 1],
...     }
... )
>>> df.group_by("a").agg(pl.col("b"), pl.col("c"))  # doctest: +IGNORE_RESULT
shape: (3, 3)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a   â”† b         â”† c         â”‚
â”‚ --- â”† ---       â”† ---       â”‚
â”‚ str â”† list[i64] â”† list[i64] â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•â•¡
â”‚ a   â”† [1, 1]    â”† [5, 3]    â”‚
â”œâ•Œâ•Œâ•Œâ•Œâ•Œâ”¼â•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ”¼â•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ”¤
â”‚ b   â”† [2, 3]    â”† [4, 2]    â”‚
â”œâ•Œâ•Œâ•Œâ•Œâ•Œâ”¼â•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ”¼â•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ•Œâ”¤
â”‚ c   â”† [3]       â”† [1]       â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜

Compute the sum of a column for each group.

>>> df.group_by("a").agg(pl.col("b").sum())  # doctest: +IGNORE_RESULT
shape: (3, 2)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ a   â”† b   â”‚
â”‚ --- â”† --- â”‚
â”‚ str â”† i64 â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ a   â”† 2   â”‚
â”‚ b   â”† 5   â”‚
â”‚ c   â”† 3   â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜

Compute multiple aggregates at once by passing a list of expressions.

>>> df.group_by("a").agg([pl.sum("b"), pl.mean("c")])  # doctest: +IGNORE_RESULT
shape: (3, 3)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ a   â”† b   â”† c   â”‚
â”‚ --- â”† --- â”† --- â”‚
â”‚ str â”† i64 â”† f64 â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ c   â”† 3   â”† 1.0 â”‚
â”‚ a   â”† 2   â”† 4.0 â”‚
â”‚ b   â”† 5   â”† 3.0 â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜

Or use positional arguments to compute multiple aggregations in the same way.

>>> df.group_by("a").agg(
...     pl.sum("b").name.suffix("_sum"),
...     (pl.col("c") ** 2).mean().name.suffix("_mean_squared"),
... )  # doctest: +IGNORE_RESULT
shape: (3, 3)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a   â”† b_sum â”† c_mean_squared â”‚
â”‚ --- â”† ---   â”† ---            â”‚
â”‚ str â”† i64   â”† f64            â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•¡
â”‚ a   â”† 2     â”† 17.0           â”‚
â”‚ c   â”† 3     â”† 1.0            â”‚
â”‚ b   â”† 5     â”† 10.0           â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜

Use keyword arguments to easily name your expression inputs.

>>> df.group_by("a").agg(
...     b_sum=pl.sum("b"),
...     c_mean_squared=(pl.col("c") ** 2).mean(),
... )  # doctest: +IGNORE_RESULT
shape: (3, 3)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a   â”† b_sum â”† c_mean_squared â”‚
â”‚ --- â”† ---   â”† ---            â”‚
â”‚ str â”† i64   â”† f64            â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•¡
â”‚ a   â”† 2     â”† 17.0           â”‚
â”‚ c   â”† 3     â”† 1.0            â”‚
â”‚ b   â”† 5     â”† 10.0           â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜
r   r%   r   r(   )r*   r&   r   r,   r-   r   r   r   r.   r3   r4   ©r   ÚaggsÚ
named_aggsr&   s       r    r.   ÚGroupBy.agg‚   s€   € õR 	=ð G‰GL‰L‹Nß‰XðØ—w‘wðUØ"&§-¡-ñUØ@D×@SÑ@SòUç‰Sðàð&à$ñ&÷ ‰W =×#5Ñ#5Ó#7ˆWÐ8ð		
r#   c                óX  • U R                   (       a  Sn[        U5      e[        S U R                   5       5      (       d  Sn[        U5      eU R                  nU R                  R
                  R                  U R                  R                  R                  X1U R                  5      5      $ )u©  
Apply a custom/user-defined function (UDF) over the groups as a sub-DataFrame.

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

Implementing logic using a Python function is almost always *significantly*
slower and more memory intensive than implementing the same logic using
the native expression API because:

- The native expression engine runs in Rust; UDFs run in Python.
- Use of Python UDFs forces the DataFrame to be materialized in memory.
- Polars-native expressions can be parallelised (UDFs cannot).
- Polars-native expressions can be logically optimised (UDFs cannot).

Wherever possible you should strongly prefer the native expression API
to achieve the best performance.

Parameters
----------
function
    Custom function that receives a DataFrame and returns a DataFrame.

Returns
-------
DataFrame

Examples
--------
For each color group sample two rows:

>>> df = pl.DataFrame(
...     {
...         "id": [0, 1, 2, 3, 4],
...         "color": ["red", "green", "green", "red", "red"],
...         "shape": ["square", "triangle", "square", "triangle", "square"],
...     }
... )
>>> df.group_by("color").map_groups(
...     lambda group_df: group_df.sample(2)
... )  # doctest: +IGNORE_RESULT
shape: (4, 3)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”
â”‚ id  â”† color â”† shape    â”‚
â”‚ --- â”† ---   â”† ---      â”‚
â”‚ i64 â”† str   â”† str      â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•¡
â”‚ 1   â”† green â”† triangle â”‚
â”‚ 2   â”† green â”† square   â”‚
â”‚ 4   â”† red   â”† square   â”‚
â”‚ 3   â”† red   â”† triangle â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜

It is better to implement this with an expression:

>>> df.filter(
...     pl.int_range(pl.len()).shuffle().over("color") < 2
... )  # doctest: +IGNORE_RESULT
z;cannot call `map_groups` when grouping by named expressionsc              3  óB   #   • U  H  n[        U[        5      v •  M     g 7f©N)Ú
isinstanceÚstr)Ú.0Úcs     r    Ú	<genexpr>Ú%GroupBy.map_groups.<locals>.<genexpr>4  s   é € Ð7ªw¨!”:˜a¤×%Ð%ªwùs   ‚z7cannot call `map_groups` when grouping by an expression)
r   Ú	TypeErrorr6   r   r   Ú	__class__Ú
_from_pydfÚ_dfÚgroup_by_map_groupsr   )r   ÚfunctionÚmsgÚby_strss       r    Ú
map_groupsÚGroupBy.map_groupsô   sƒ   € ðz ==ØOˆCÜ˜C“.Ð ÜÑ7¨t¯wªwÓ7×7Ñ7ØKˆCÜ˜C“.Ð à!ŸW™Wˆàw‰w× Ñ ×+Ñ+ØG‰GK‰K×+Ñ+¨G¸t×?RÑ?RÓSó
ð 	
r#   c                óú   • SSK Jn  U R                  R                  5       R                  " U R
                  0 U R                  DSU R                  0D6R                  U5      R                  UR                  5       S9$ )u&  
Get the first `n` rows of each group.

Parameters
----------
n
    Number of rows to return.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "letters": ["c", "c", "a", "c", "a", "b"],
...         "nrs": [1, 2, 3, 4, 5, 6],
...     }
... )
>>> df
shape: (6, 2)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ letters â”† nrs â”‚
â”‚ ---     â”† --- â”‚
â”‚ str     â”† i64 â”‚
â•žâ•â•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ c       â”† 1   â”‚
â”‚ c       â”† 2   â”‚
â”‚ a       â”† 3   â”‚
â”‚ c       â”† 4   â”‚
â”‚ a       â”† 5   â”‚
â”‚ b       â”† 6   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
>>> df.group_by("letters").head(2).sort("letters")
shape: (5, 2)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ letters â”† nrs â”‚
â”‚ ---     â”† --- â”‚
â”‚ str     â”† i64 â”‚
â•žâ•â•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ a       â”† 3   â”‚
â”‚ a       â”† 5   â”‚
â”‚ b       â”† 6   â”‚
â”‚ c       â”† 1   â”‚
â”‚ c       â”† 2   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
r   r%   r   r(   )r*   r&   r   r,   r-   r   r   r   Úheadr3   Ú_eager©r   Únr&   s      r    rh   ÚGroupBy.head>  sm   € õZ 	=ð G‰GL‰L‹Nß‰XðØ—w‘wðUØ"&§-¡-ñUØ@D×@SÑ@SòUç‰T!‹Wß‰W =×#7Ñ#7Ó#9ˆWÐ:ð		
r#   c                óú   • SSK Jn  U R                  R                  5       R                  " U R
                  0 U R                  DSU R                  0D6R                  U5      R                  UR                  5       S9$ )u%  
Get the last `n` rows of each group.

Parameters
----------
n
    Number of rows to return.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "letters": ["c", "c", "a", "c", "a", "b"],
...         "nrs": [1, 2, 3, 4, 5, 6],
...     }
... )
>>> df
shape: (6, 2)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ letters â”† nrs â”‚
â”‚ ---     â”† --- â”‚
â”‚ str     â”† i64 â”‚
â•žâ•â•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ c       â”† 1   â”‚
â”‚ c       â”† 2   â”‚
â”‚ a       â”† 3   â”‚
â”‚ c       â”† 4   â”‚
â”‚ a       â”† 5   â”‚
â”‚ b       â”† 6   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
>>> df.group_by("letters").tail(2).sort("letters")
shape: (5, 2)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ letters â”† nrs â”‚
â”‚ ---     â”† --- â”‚
â”‚ str     â”† i64 â”‚
â•žâ•â•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ a       â”† 3   â”‚
â”‚ a       â”† 5   â”‚
â”‚ b       â”† 6   â”‚
â”‚ c       â”† 2   â”‚
â”‚ c       â”† 4   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
r   r%   r   r(   )r*   r&   r   r,   r-   r   r   r   Útailr3   r4   rj   s      r    rn   ÚGroupBy.tailt  sm   € õZ 	=ð G‰GL‰L‹Nß‰XðØ—w‘wðUØ"&§-¡-ñUØ@D×@SÑ@SòUç‰T!‹Wß‰W =×#5Ñ#5Ó#7ˆWÐ8ð		
r#   c                óJ   • U R                  [        R                  " 5       5      $ )uò  
Aggregate the groups into Series.

Examples
--------
>>> df = pl.DataFrame({"a": ["one", "two", "one", "two"], "b": [1, 2, 3, 4]})
>>> df.group_by("a", maintain_order=True).all()
shape: (2, 2)
â”Œâ”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a   â”† b         â”‚
â”‚ --- â”† ---       â”‚
â”‚ str â”† list[i64] â”‚
â•žâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•â•¡
â”‚ one â”† [1, 3]    â”‚
â”‚ two â”† [2, 4]    â”‚
â””â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   ©r   s    r    r6   ÚGroupBy.allª  s   € ð$ x‰xœŸš›Ó Ð r#   Nc                óv   • [         R                  " 5       nUb  UR                  U5      nU R                  U5      $ )u‹  
Return the number of rows in each group.

Parameters
----------
name
    Assign a name to the resulting column; if unset, defaults to "len".

Examples
--------
>>> df = pl.DataFrame({"a": ["Apple", "Apple", "Orange"], "b": [1, None, 2]})
>>> df.group_by("a").len()  # doctest: +IGNORE_RESULT
shape: (2, 2)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ a      â”† len â”‚
â”‚ ---    â”† --- â”‚
â”‚ str    â”† u32 â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ Apple  â”† 2   â”‚
â”‚ Orange â”† 1   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
>>> df.group_by("a").len(name="n")  # doctest: +IGNORE_RESULT
shape: (2, 2)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ a      â”† n   â”‚
â”‚ ---    â”† --- â”‚
â”‚ str    â”† u32 â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ Apple  â”† 2   â”‚
â”‚ Orange â”† 1   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
)r/   rF   r2   r.   )r   ÚnameÚlen_exprs      r    rF   ÚGroupBy.len¾  s3   € ôB —5’5“7ˆØÑØ—~‘~ dÓ+ˆHØx‰x˜Ó!Ð!r#   z6`GroupBy.count` was renamed; use `GroupBy.len` insteadc                óh   • U R                  [        R                  " 5       R                  S5      5      $ )u¢  
Return the number of rows in each group.

.. deprecated:: 0.20.5
    This method has been renamed to :func:`GroupBy.len`.

Rows containing null values count towards the total.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": ["Apple", "Apple", "Orange"],
...         "b": [1, None, 2],
...     }
... )
>>> df.group_by("a").count()  # doctest: +SKIP
shape: (2, 2)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”
â”‚ a      â”† count â”‚
â”‚ ---    â”† ---   â”‚
â”‚ str    â”† u32   â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•¡
â”‚ Apple  â”† 2     â”‚
â”‚ Orange â”† 1     â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”˜
Úcount)r.   r/   rF   r2   rq   s    r    rx   ÚGroupBy.countä  s"   € ð: x‰xœŸš›Ÿ™ gÓ.Ó/Ð/r#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )uš  
Aggregate the first values in the group.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 13, 14],
...         "c": [True, True, True, False, False, True],
...         "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).first()
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b    â”† c     â”‚
â”‚ ---    â”† --- â”† ---  â”† ---   â”‚
â”‚ str    â”† i64 â”† f64  â”† bool  â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•¡
â”‚ Apple  â”† 1   â”† 0.5  â”† true  â”‚
â”‚ Orange â”† 2   â”† 0.5  â”† true  â”‚
â”‚ Banana â”† 4   â”† 13.0 â”† false â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   r0   rq   s    r    r0   ÚGroupBy.first  s   € ð4 x‰xœŸš›Ÿ™›Ó(Ð(r#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )u˜  
Aggregate the last values in the group.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 14, 13],
...         "c": [True, True, True, False, False, True],
...         "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).last()
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b    â”† c     â”‚
â”‚ ---    â”† --- â”† ---  â”† ---   â”‚
â”‚ str    â”† i64 â”† f64  â”† bool  â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•¡
â”‚ Apple  â”† 3   â”† 10.0 â”† false â”‚
â”‚ Orange â”† 2   â”† 0.5  â”† true  â”‚
â”‚ Banana â”† 5   â”† 13.0 â”† true  â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   Úlastrq   s    r    r}   ÚGroupBy.last  ó   € ð4 x‰xœŸš›Ÿ™›Ó'Ð'r#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )uˆ  
Reduce the groups to the maximal value.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 13, 14],
...         "c": [True, True, True, False, False, True],
...         "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).max()
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b    â”† c    â”‚
â”‚ ---    â”† --- â”† ---  â”† ---  â”‚
â”‚ str    â”† i64 â”† f64  â”† bool â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•¡
â”‚ Apple  â”† 3   â”† 10.0 â”† true â”‚
â”‚ Orange â”† 2   â”† 0.5  â”† true â”‚
â”‚ Banana â”† 5   â”† 14.0 â”† true â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   Úmaxrq   s    r    r   ÚGroupBy.max;  ó   € ð4 x‰xœŸš›Ÿ™›Ó&Ð&r#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )uÿ  
Reduce the groups to the mean values.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 13, 14],
...         "c": [True, True, True, False, False, True],
...         "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).mean()
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b        â”† c        â”‚
â”‚ ---    â”† --- â”† ---      â”† ---      â”‚
â”‚ str    â”† f64 â”† f64      â”† f64      â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•â•â•â•¡
â”‚ Apple  â”† 2.0 â”† 4.833333 â”† 0.666667 â”‚
â”‚ Orange â”† 2.0 â”† 0.5      â”† 1.0      â”‚
â”‚ Banana â”† 4.5 â”† 13.5     â”† 0.5      â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   Úmeanrq   s    r    r…   ÚGroupBy.meanW  r   r#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )u²  
Return the median per group.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 13, 14],
...         "d": ["Apple", "Banana", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).median()
shape: (2, 3)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b    â”‚
â”‚ ---    â”† --- â”† ---  â”‚
â”‚ str    â”† f64 â”† f64  â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•¡
â”‚ Apple  â”† 2.0 â”† 4.0  â”‚
â”‚ Banana â”† 4.0 â”† 13.0 â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   Úmedianrq   s    r    rˆ   ÚGroupBy.medians  s    € ð0 x‰xœŸš›Ÿ™Ó(Ó)Ð)r#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )u—  
Reduce the groups to the minimal value.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 13, 14],
...         "c": [True, True, True, False, False, True],
...         "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).min()
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b    â”† c     â”‚
â”‚ ---    â”† --- â”† ---  â”† ---   â”‚
â”‚ str    â”† i64 â”† f64  â”† bool  â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•â•¡
â”‚ Apple  â”† 1   â”† 0.5  â”† false â”‚
â”‚ Orange â”† 2   â”† 0.5  â”† true  â”‚
â”‚ Banana â”† 4   â”† 13.0 â”† false â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   Úminrq   s    r    r‹   ÚGroupBy.min  rƒ   r#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )u®  
Count the unique values per group.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 1, 3, 4, 5],
...         "b": [0.5, 0.5, 0.5, 10, 13, 14],
...         "d": ["Apple", "Banana", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).n_unique()
shape: (2, 3)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b   â”‚
â”‚ ---    â”† --- â”† --- â”‚
â”‚ str    â”† u32 â”† u32 â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ Apple  â”† 2   â”† 2   â”‚
â”‚ Banana â”† 3   â”† 3   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   Ún_uniquerq   s    r    rŽ   ÚGroupBy.n_unique©  s"   € ð0 x‰xœŸš›×(Ñ(Ó*Ó+Ð+r#   c                ód   • U R                  [        R                  " 5       R                  XS95      $ )u‰  
Compute the quantile per group.

Parameters
----------
quantile
    Quantile between 0.0 and 1.0.
interpolation : {'nearest', 'higher', 'lower', 'midpoint', 'linear', 'equiprobable'}
    Interpolation method.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 13, 14],
...         "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).quantile(1)
shape: (3, 3)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b    â”‚
â”‚ ---    â”† --- â”† ---  â”‚
â”‚ str    â”† f64 â”† f64  â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•¡
â”‚ Apple  â”† 3.0 â”† 10.0 â”‚
â”‚ Orange â”† 2.0 â”† 0.5  â”‚
â”‚ Banana â”† 5.0 â”† 14.0 â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”˜
)Úinterpolation)r.   r/   r6   Úquantile)r   r’   r‘   s      r    r’   ÚGroupBy.quantileÃ  s(   € ðD x‰xœŸš›×(Ñ(¨Ð(ÐOÓPÐPr#   c                óf   • U R                  [        R                  " 5       R                  5       5      $ )uo  
Reduce the groups to the sum.

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 2, 3, 4, 5],
...         "b": [0.5, 0.5, 4, 10, 13, 14],
...         "c": [True, True, True, False, False, True],
...         "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"],
...     }
... )
>>> df.group_by("d", maintain_order=True).sum()
shape: (3, 4)
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
â”‚ d      â”† a   â”† b    â”† c   â”‚
â”‚ ---    â”† --- â”† ---  â”† --- â”‚
â”‚ str    â”† i64 â”† f64  â”† u32 â”‚
â•žâ•â•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
â”‚ Apple  â”† 6   â”† 14.5 â”† 2   â”‚
â”‚ Orange â”† 2   â”† 0.5  â”† 1   â”‚
â”‚ Banana â”† 9   â”† 27.0 â”† 1   â”‚
â””â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
)r.   r/   r6   Úsumrq   s    r    r•   ÚGroupBy.sumç  rƒ   r#   )r<   r;   r9   r   r   r   r   )
r   r   r   úIntoExpr | Iterable[IntoExpr]r   Úboolr   r   ÚreturnÚNone©r™   r   )r™   z!tuple[tuple[Any, ...], DataFrame]©rQ   r—   rR   r   r™   r   )rb   ú Callable[[DataFrame], DataFrame]r™   r   )é   )rk   Úintr™   r   )r™   r   rV   )rt   z
str | Noner™   r   )Únearest)r’   Úfloatr‘   r   r™   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   r@   rL   r.   re   rh   rn   r6   rF   r	   rx   r0   r}   r   r…   rˆ   r‹   rŽ   r’   r•   Ú__static_attributes__© r#   r    r   r   #   sõ   † Ù)ð-àð-ð +ð-ð ð	-ð
 ð-ð 
ô-ô>1ôf&ðp
à,ðp
ð ðp
ð 
ô	p
ôdH
öT4
öl4
ôl!ö($"ñL ÐHÓIó0ó Jð0ô<)ô8(ô8'ô8(ô8*ô4'ô8,ð6 @Ið"QØð"QØ.<ð"Qà	õ"Q÷H'r#   r   c                  ó~   • \ rS rSrSr              S
S jrSS jrSS jr      SS jr      SS jr	Sr
g	)ÚRollingGroupByi  zy
A rolling grouper.

This has an `.agg` method which will allow you to run all polars expressions in a
group by context.
c               óx   • [        U5      n[        U5      nXl        X l        X0l        X@l        XPl        X`l        g rV   )r   r   Útime_columnÚperiodÚoffsetÚclosedr-   )r   r   Úindex_columnr­   r®   r¯   r-   s          r    r!   ÚRollingGroupBy.__init__  s7   € ô *¨&Ó1ˆÜ)¨&Ó1ˆàŒØ'ÔØŒØŒØŒØ r#   c                óf  • SSK Jn  SnU R                  R                  5       R	                  U R
                  U R                  U R                  U R                  U R                  S9R                  [        R                  " 5       R                  5       R                  U5      5      R                  UR!                  5       S9nUR#                  [        R$                  " 5       R'                  U5      5      R)                  5       U l        UR#                  U5      R-                  5       U l        SU l        U $ )Nr   r%   r'   ©r°   r­   r®   r¯   r-   r(   )r*   r&   r   r,   Úrollingr¬   r­   r®   r¯   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   s       r    r@   ÚRollingGroupBy.__iter__   sá   € Ý<à.ˆàG‰GL‰L‹Nß‰WØ!×-Ñ-Ø—{‘{Ø—{‘{Ø—{‘{ØŸ™ð ð ÷ ‰S”—’“×%Ñ%Ó'×-Ñ-¨hÓ7Ó8ß‰W =×#5Ñ#5Ó#7ˆWÐ8ð 	ð &×,Ñ,¬Q¯UªU«W¯_©_¸XÓ-FÓG×QÑQÓSˆÔØ'×.Ñ.¨xÓ8×BÑBÓDˆÔØˆÔàˆr#   c                ó  • U R                   [        U R                  5      :¼  a  [        e[	        U R
                  5      nU R                  U R                  U R                      S S 24   nU =R                   S-  sl         X4$ rC   rE   rI   s      r    rL   ÚRollingGroupBy.__next__7  rN   r#   c                ó  • SSK Jn  U R                  R                  5       R	                  U R
                  U R                  U R                  U R                  U R                  S9R                  " U0 UD6R                  UR                  5       S9$ )á“  
Compute aggregations for each group of a group by operation.

Parameters
----------
*aggs
    Aggregations to compute for each group of the group by operation,
    specified as positional arguments.
    Accepts expression input. Strings are parsed as column names.
**named_aggs
    Additional aggregations, specified as keyword arguments.
    The resulting columns will be renamed to the keyword used.
r   r%   r³   r(   )r*   r&   r   r,   r´   r¬   r­   r®   r¯   r-   r.   r3   r4   rP   s       r    r.   ÚRollingGroupBy.aggA  s†   € õ$ 	=ð G‰GL‰L‹Nß‰WØ!×-Ñ-Ø—{‘{Ø—{‘{Ø—{‘{ØŸ™ð ð ÷ ‰Sðð ð&ð %ñ&÷ ‰W =×#5Ñ#5Ó#7ˆWÐ8ð	
r#   c                ó  • SSK Jn  U R                  R                  5       R	                  U R
                  U R                  U R                  U R                  U R                  S9R                  X5      R                  UR                  5       S9$ )áf  
Apply a custom/user-defined function (UDF) over the groups as a new DataFrame.

Using this is considered an anti-pattern as it will be very slow because:

- it forces the engine to materialize the whole `DataFrames` for the groups.
- it is not parallelized.
- it blocks optimizations as the passed python function is opaque to the
  optimizer.

The idiomatic way to apply custom functions over multiple columns is using:

`pl.struct([my_columns]).map_elements(lambda struct_series: ..)`

Parameters
----------
function
    Function to apply over each group of the `LazyFrame`; it receives
    a DataFrame and should return a DataFrame.
schema
    Schema of the output function. This has to be known statically. If the
    given schema is incorrect, this is a bug in the caller's query and may
    lead to errors. If set to None, polars assumes the schema is unchanged.
r   r%   r³   r(   )r*   r&   r   r,   r´   r¬   r­   r®   r¯   r-   re   r3   r4   ©r   rb   Úschemar&   s       r    re   ÚRollingGroupBy.map_groupsb  sp   € õ: 	=ð G‰GL‰L‹Nß‰WØ!×-Ñ-Ø—{‘{Ø—{‘{Ø—{‘{ØŸ™ð ð ÷ ‰Z˜Ó)ß‰W =×#5Ñ#5Ó#7ˆWÐ8ð	
r#   )	r<   r;   r9   r¯   r   r-   r®   r­   r¬   N)r   r   r°   r   r­   ústr | timedeltar®   ústr | timedelta | Noner¯   r   r-   ú$IntoExpr | Iterable[IntoExpr] | Noner™   rš   r›   ©r™   z$tuple[tuple[object, ...], DataFrame]rœ   ©rb   r   r¾   zSchemaDict | Noner™   r   ©r¢   r£   r¤   r¥   r¦   r!   r@   rL   r.   re   r§   r¨   r#   r    rª   rª     s   † ñð!àð!ð ð!ð
  ð!ð 'ð!ð ð!ð 7ð!ð 
ô!ô(ô.&ð
à,ð
ð ð
ð 
ô	
ðB*
à2ð*
ð "ð*
ð 
÷	*
r#   rª   c                  óŽ   • \ rS rSrSr                      S
S jrSS jrSS jr      SS jr      SS jr	Sr
g	)ÚDynamicGroupByi  zu
A dynamic grouper.

This has an `.agg` method which allows you to run all polars expressions in a
group by context.
c               ó¾   • [        U5      n[        U5      n[        U5      nXl        X l        X0l        X@l        XPl        X€l        X`l        Xpl        Xl	        X l
        g rV   )r   r   r¬   Úeveryr­   r®   ÚlabelÚinclude_boundariesr¯   r-   Ústart_by)r   r   r°   rÉ   r­   r®   rË   r¯   rÊ   r-   rÌ   s              r    r!   ÚDynamicGroupBy.__init__—  sV   € ô )¨Ó/ˆÜ)¨&Ó1ˆÜ)¨&Ó1ˆàŒØ'ÔØŒ
ØŒØŒØŒ
Ø"4ÔØŒØ ŒØ r#   c                ó¾  • SSK Jn  SnU R                  R                  5       R	                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  S9	R                  [        R                   " 5       R#                  5       R%                  U5      5      R'                  UR)                  5       S9nUR+                  [        R,                  " 5       R/                  U5      5      R1                  5       U l        UR+                  U5      R5                  5       U l        SU l        U $ )Nr   r%   r'   ©	r°   rÉ   r­   r®   rÊ   rË   r¯   r-   rÌ   r(   )r*   r&   r   r,   Úgroup_by_dynamicr¬   rÉ   r­   r®   rÊ   rË   r¯   r-   rÌ   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   s       r    r@   ÚDynamicGroupBy.__iter__´  s   € Ý<à.ˆàG‰GL‰L‹NßÑØ!×-Ñ-Ø—j‘jØ—{‘{Ø—{‘{Ø—j‘jØ#'×#:Ñ#:Ø—{‘{ØŸ™ØŸ™ð ð 
÷ ‰S”—’“×%Ñ%Ó'×-Ñ-¨hÓ7Ó8ß‰W =×#5Ñ#5Ó#7ˆWÐ8ð 	ð" &×,Ñ,¬Q¯UªU«W¯_©_¸XÓ-FÓG×QÑQÓSˆÔØ'×.Ñ.¨xÓ8×BÑBÓDˆÔØˆÔàˆr#   c                ó  • U R                   [        U R                  5      :¼  a  [        e[	        U R
                  5      nU R                  U R                  U R                      S S 24   nU =R                   S-  sl         X4$ rC   rE   rI   s      r    rL   ÚDynamicGroupBy.__next__Ï  rN   r#   c                óv  • SSK Jn  U R                  R                  5       R	                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  S9	R                  " U0 UD6R                  UR!                  5       S9$ )r¹   r   r%   rÏ   r(   )r*   r&   r   r,   rÐ   r¬   rÉ   r­   r®   rÊ   rË   r¯   r-   rÌ   r.   r3   r4   rP   s       r    r.   ÚDynamicGroupBy.aggÙ  s¥   € õ$ 	=ð G‰GL‰L‹NßÑØ!×-Ñ-Ø—j‘jØ—{‘{Ø—{‘{Ø—j‘jØ#'×#:Ñ#:Ø—{‘{ØŸ™ØŸ™ð ð 
÷ ‰Sðð ð&ð %ñ&÷ ‰W =×#5Ñ#5Ó#7ˆWÐ8ð	
r#   c                ó^  • SSK Jn  U R                  R                  5       R	                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  S9R                  X5      R                  UR                  5       S9$ )r¼   r   r%   )r°   rÉ   r­   r®   rË   r¯   r-   rÌ   r(   )r*   r&   r   r,   rÐ   r¬   rÉ   r­   r®   rË   r¯   r-   rÌ   re   r3   r4   r½   s       r    re   ÚDynamicGroupBy.map_groupsþ  sˆ   € õ: 	=ð G‰GL‰L‹NßÑØ!×-Ñ-Ø—j‘jØ—{‘{Ø—{‘{Ø#'×#:Ñ#:Ø—{‘{ØŸ™ØŸ™ð ð 	÷ ‰Z˜Ó)ß‰W =×#5Ñ#5Ó#7ˆWÐ8ð	
r#   )r<   r;   r9   r¯   r   rÉ   r-   rË   rÊ   r®   r­   rÌ   r¬   N)r   r   r°   r   rÉ   rÀ   r­   rÁ   r®   rÁ   rË   r˜   r¯   r   rÊ   r   r-   rÂ   rÌ   r   r™   rš   r›   rÃ   rœ   rÄ   rÅ   r¨   r#   r    rÇ   rÇ     sÅ   † ñð!àð!ð ð!ð
 ð!ð 'ð!ð 'ð!ð !ð!ð ð!ð ð!ð 7ð!ð ð!ð 
ô!ô:ô6&ð#
à,ð#
ð ð#
ð 
ô	#
ðJ-
à2ð-
ð "ð-
ð 
÷	-
r#   rÇ   )!Ú
__future__r   Útypingr   r   r   Úpolarsr   r/   Úpolars._utils.convertr   Úpolars._utils.deprecationr	   ÚsysÚcollections.abcr
   Údatetimer   r   Úpolars._typingr   r   r   r   r   r   Úversion_infor   Útyping_extensionsÚwarningsr   rª   rÇ   r¨   r#   r    Ú<module>rä      s€   ðÝ "ç /Ñ /å !Ý :Ý 0æÛÝ(Ý"å ÷÷ ð ×Ñ˜7Ó"Þå*à
×Ñ˜7Ó"Þ'å0÷^'ñ ^'÷BH
ñ H
÷V\
ò \
r#   