Ë
    u™ãj­â ã                  óà  — U d Z ddlmZ ddlmZmZmZmZmZm	Z	 ddl
Z
ddlmZmZ ddlmZmZmZmZmZmZmZmZmZ ddlZddlZddlmZmZ ddlmZ ddl m!c m"Z# dd	l$m%Z% dd
l&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z4 ddl5m6Z6m7Z7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z>m?Z? ddl@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZK ddlLmMZMmNZNmOZO ddlPmQZQmRZR ddlSmTZT ddlUmVZVmWZWmXZXmYZY ddlZm[Z[ ddl\m]Z] ddl^m_Z_m`Z` ddlambc mcZd ddlemfZf ddlgmhZh ddlimjZjmkZkmlZl ddlmmnZn ddlompZpmqZq ddlrmsZsmtZtmuZu ddlvmwZw ddlxmyZy dd lzm{Z{ dd!l|m}Z}m~Z~mZ er2dd"l€m�Z� dd#l‚mƒZƒ dd$l&m„Z„m…Z…m†Z†m‡Z‡mˆZˆm‰Z‰ dd%lŠm‹Z‹ dd&lŒm�Z� dd'lŽm�Z�m�Z�m‘Z‘ e G d(„ d)e_«      «       Z’ee“e   z  eegef   z  e“eegef      z  eeef   z  Z”d*e•d+<    G d,„ d-e_e`e,   ep«      Z– ed.eh¬/«      Z— G d0„ d1e–e,   «      Z˜	 	 	 d4	 	 	 	 	 	 	 	 	 d5d2„Z™d6d3„Zšy)7a  
Provide the groupby split-apply-combine paradigm. Define the GroupBy
class providing the base-class of operations.

The SeriesGroupBy and DataFrameGroupBy sub-class
(defined in pandas.core.groupby.generic)
expose these user-facing objects to provide specific functionality.
é    )Úannotations)ÚCallableÚHashableÚIterableÚIteratorÚMappingÚSequenceN)ÚpartialÚwraps)	ÚTYPE_CHECKINGÚConcatenateÚLiteralÚSelfÚ	TypeAliasÚTypeVarÚcastÚfinalÚoverload)Ú	TimestampÚlib)Úrank_1d)ÚNA)ÚAnyArrayLikeÚ	ArrayLikeÚ
IndexLabelÚIntervalClosedTypeÚListLikeÚNDFrameTÚPositionalIndexerÚRandomStateÚ
RankMethodÚRankNaOptionÚnpt)Úfunction)ÚAbstractMethodErrorÚ	DataErrorÚPandas4Warning)Úcache_readonly)Úfind_stack_level)Úcoerce_indexer_dtypeÚensure_dtype_can_hold_na)Úis_boolÚis_bool_dtypeÚis_hashableÚ
is_integerÚis_integer_dtypeÚis_list_likeÚis_numeric_dtypeÚis_object_dtypeÚ	is_scalarÚis_string_dtypeÚpandas_dtype)ÚisnaÚna_value_for_dtypeÚnotna)Ú
algorithmsÚsample)Úexecutor)ÚArrowExtensionArrayÚBaseMaskedArrayÚExtensionArrayÚIntegerArray)ÚStringDtype)ÚArrowStringArray)ÚPandasObjectÚSelectionMixin)Ú	DataFrame)ÚNDFrame)ÚbaseÚnumba_Úops)Úget_grouper)ÚGroupByIndexingMixinÚGroupByNthSelector)ÚIndexÚ
MultiIndexÚdefault_index)Úensure_block_shape)ÚSeries)Úget_group_index_sorter)Úget_jit_argumentsÚmaybe_use_numbaÚprepare_function_arguments)Ú
BaseOffset)Ú	Timedelta)ÚAnyÚLevelÚPÚTÚTimedeltaConvertibleTypesÚTimestampConvertibleTypes)ÚBaseIndexer)Ú	Resampler)ÚExpandingGroupByÚExponentialMovingWindowGroupByÚRollingGroupByc                  ó&   — e Zd ZdZdd„Zd„ Zdd„Zy)ÚGroupByPlotzE
    Class implementing the .plot attribute for groupby objects.
    c                ó   — || _         y ©N)Ú_groupby)ÚselfÚgroupbys     úf/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/pandas/core/groupby/groupby.pyÚ__init__zGroupByPlot.__init__£   s	   € Øˆ�ó    c                óV   ‡‡— ˆˆfd„}d|_         | j                  j                  |«      S )Nc                ó(   •—  | j                   ‰i ‰¤ŽS rf   )Úplot)rh   ÚkeyÚargsÚkwargss     €€rj   ÚfzGroupByPlot.__call__.<locals>.f§   s   ø€ Ø�4—9‘9˜dÐ- fÑ-Ð-rl   ro   )Ú__name__rg   Ú_python_apply_plot)rh   rq   rr   rs   s    `` rj   Ú__call__zGroupByPlot.__call__¦   s&   ù€ õ	.ð ˆŒ
à�}‰}×/Ñ/°Ó2Ð2rl   c                ó   ‡ ‡— ˆˆ fd„}|S )Nc                 óL   •‡ ‡— ˆ ˆˆfd„}‰j                   j                  |«      S )Nc                ó¬   •— ‰j                  «       }‰dk(  r#‰j                  d«      r|j                  d|«        t        | j                  ‰«      ‰i |¤ŽS )NÚscatterÚlegendÚlabel)ÚcopyÚgetÚ
setdefaultÚgetattrro   )rh   rp   Úlocal_kwargsrq   rr   Únames      €€€rj   rs   z0GroupByPlot.__getattr__.<locals>.attr.<locals>.f°   sN   ø€ Ø%Ÿ{™{›}�à˜9Ò$¨¯©°HÔ)=Ø ×+Ñ+¨G°SÔ9à/”w˜tŸy™y¨$Ó/°ÐF¸ÑFÐFrl   )rg   ru   )rq   rr   rs   r‚   rh   s   `` €€rj   Úattrz%GroupByPlot.__getattr__.<locals>.attr¯   s    ú€ öGð —=‘=×3Ñ3°AÓ6Ð6rl   © )rh   r‚   rƒ   s   `` rj   Ú__getattr__zGroupByPlot.__getattr__®   s   ù€ õ		7ð ˆrl   N)ri   ÚGroupByÚreturnÚNone©r‚   Ústr)rt   Ú
__module__Ú__qualname__Ú__doc__rk   rv   r…   r„   rl   rj   rd   rd   �   s   „ ñó ò3ôrl   rd   r   Ú_KeysArgTypec                  ó”  — e Zd ZU ej                  h d£z  Zded<   dZded<   dZded<   d	ed
<   edd„«       Z	edd„«       Z
eedd„«       «       Zeedd„«       «       Zeedd„«       «       Zed„ «       Zeed„ «       «       Zedd„«       Ze	 	 	 	 	 	 	 	 dd„«       Ze	 	 	 	 	 	 	 	 dd„«       Z	 	 	 	 	 	 	 	 dd„Zed d„«       Zed!d„«       Zy)"ÚBaseGroupBy>
   ÚobjÚkeysÚsortÚlevelÚdropnaÚgrouperÚas_indexÚobservedÚ
exclusionsÚ
group_keysúops.BaseGrouperÚ_grouperNú_KeysArgType | Noner’   úIndexLabel | Noner”   Úboolrš   c                ó.   — | j                   j                  S rf   ©rœ   Úngroups©rh   s    rj   Ú__len__zBaseGroupBy.__len__Ù   s   € à�}‰}×$Ñ$Ð$rl   c                ó,   — t         j                  | «      S rf   )ÚobjectÚ__repr__r£   s    rj   r§   zBaseGroupBy.__repr__Ý   s   € ô �‰˜tÓ$Ð$rl   c                ó  — t        | j                  t        «      r]t        | j                  «      dk(  rEt	        j
                  d| j                  d   › d| j                  d   › d�t        t        «       ¬«       | j                  j                  S )aQ  
        Dict {group name -> group labels}.

        This property provides a dictionary representation of the groupings formed
        during a groupby operation, where each key represents a unique group value from
        the specified column(s), and each value is a list of index labels
        that belong to that group.

        See Also
        --------
        core.groupby.DataFrameGroupBy.get_group : Retrieve group from a
            ``DataFrameGroupBy`` object with provided name.
        core.groupby.SeriesGroupBy.get_group : Retrieve group from a
            ``SeriesGroupBy`` object with provided name.
        core.resample.Resampler.get_group : Retrieve group from a
            ``Resampler`` object with provided name.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, 3], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        dtype: int64
        >>> ser.groupby(level=0).groups
        {'a': ['a', 'a'], 'b': ['b']}

        For DataFrameGroupBy:

        >>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]]
        >>> df = pd.DataFrame(data, columns=["a", "b", "c"])
        >>> df
           a  b  c
        0  1  2  3
        1  1  5  6
        2  7  8  9
        >>> df.groupby(by="a").groups
        {1: [0, 1], 7: [2]}

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 2, 3, 4],
        ...     index=pd.DatetimeIndex(
        ...         ["2023-01-01", "2023-01-15", "2023-02-01", "2023-02-15"]
        ...     ),
        ... )
        >>> ser
        2023-01-01    1
        2023-01-15    2
        2023-02-01    3
        2023-02-15    4
        dtype: int64
        >>> ser.resample("MS").groups
        {Timestamp('2023-01-01 00:00:00'): np.int64(2),
         Timestamp('2023-02-01 00:00:00'): np.int64(4)}
        é   zWIn a future version, the keys of `groups` will be a tuple with a single element, e.g. (r   z,) , instead of a scalar, e.g. z“, when grouping by a list with a single element. Use ``df.groupby(by='a').groups`` instead of ``df.groupby(by=['a']).groups`` to avoid this warning©Ú
stacklevel)
Ú
isinstancer’   ÚlistÚlenÚwarningsÚwarnr'   r)   rœ   Úgroupsr£   s    rj   r±   zBaseGroupBy.groupsâ   s|   € ôB �d—i‘i¤Ô&¬3¨t¯y©y«>¸QÒ+>Ü�M‰Mð6Ø6:·i±iÀ±l°^ð D-Ø-1¯Y©Y°q©\¨Nð ;SðSô
 Ü+Ó-õð �}‰}×#Ñ#Ð#rl   c                ó.   — | j                   j                  S rf   r¡   r£   s    rj   r¢   zBaseGroupBy.ngroups/  s   € ð �}‰}×$Ñ$Ð$rl   c                ó.   — | j                   j                  S )ak  
        Dict {group name -> group indices}.

        The dictionary keys represent the group labels (e.g., timestamps for a
        time-based resampling operation), and the values are arrays of integer
        positions indicating where the elements of each group are located in the
        original data. This property is particularly useful when working with
        resampled data, as it provides insight into how the original time-series data
        has been grouped.

        See Also
        --------
        core.groupby.DataFrameGroupBy.indices : Provides a mapping of group rows to
            positions of the elements.
        core.groupby.SeriesGroupBy.indices : Provides a mapping of group rows to
            positions of the elements.
        core.resample.Resampler.indices : Provides a mapping of group rows to
            positions of the elements.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, 3], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        dtype: int64
        >>> ser.groupby(level=0).indices
        {'a': array([0, 1]), 'b': array([2])}

        For DataFrameGroupBy:

        >>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["owl", "toucan", "eagle"]
        ... )
        >>> df
                a  b  c
        owl     1  2  3
        toucan  1  5  6
        eagle   7  8  9
        >>> df.groupby(by=["a"]).indices
        {np.int64(1): array([0, 1]), np.int64(7): array([2])}

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 2, 3, 4],
        ...     index=pd.DatetimeIndex(
        ...         ["2023-01-01", "2023-01-15", "2023-02-01", "2023-02-15"]
        ...     ),
        ... )
        >>> ser
        2023-01-01    1
        2023-01-15    2
        2023-02-01    3
        2023-02-15    4
        dtype: int64
        >>> ser.resample("MS").indices
        defaultdict(<class 'list'>, {Timestamp('2023-01-01 00:00:00'): [0, 1],
        Timestamp('2023-02-01 00:00:00'): [2, 3]})
        )rœ   Úindicesr£   s    rj   r´   zBaseGroupBy.indices4  s   € ðJ �}‰}×$Ñ$Ð$rl   c                ó¼  ‡— d„ Št        |«      r*| j                  j                  t        j                  g «      S t        |t        «      rt        d„ |D «       «      }t        | j                  «      dkD  rt        t        | j                  «      «      }nd}t        |t        «      rnt        |t        «      sd}t        |«      ‚t        |«      t        |«      k(  s	 | j                  |   S ˆfd„|D «       }t        d„ t        ||d	¬
«      D «       «      }n ‰|«      } ||«      }| j                  j                  |g «      S # t        $ r}d}t        |«      |‚d}~ww xY w)zd
        Safe get multiple indices, translate keys for
        datelike to underlying repr.
        c                ó|   — t        | t        j                  «      rd„ S t        | t        j                  «      rd„ S d„ S )Nc                ó   — t        | «      S rf   )r   ©rp   s    rj   ú<lambda>z?BaseGroupBy._get_index.<locals>.get_converter.<locals>.<lambda>†  s
   € ¤9¨S£>€ rl   c                ó,   — t        | «      j                  S rf   )r   Úasm8r¸   s    rj   r¹   z?BaseGroupBy._get_index.<locals>.get_converter.<locals>.<lambda>ˆ  s   € ¤9¨S£>×#6Ñ#6€ rl   c                ó   — | S rf   r„   r¸   s    rj   r¹   z?BaseGroupBy._get_index.<locals>.get_converter.<locals>.<lambda>Š  s   €  3€ rl   )r¬   ÚdatetimeÚnpÚ
datetime64)Úss    rj   Úget_converterz-BaseGroupBy._get_index.<locals>.get_converter‚  s4   € ô ˜!œX×.Ñ.Ô/Ù1Ð1Ü˜AœrŸ}™}Ô-Ù6Ð6á&Ð&rl   c              3  óV   K  — | ]!  }t        |«      rt        j                  n|–— Œ# y ­wrf   )r7   r¾   Únan)Ú.0Úcomps     rj   ú	<genexpr>z)BaseGroupBy._get_index.<locals>.<genexpr>�  s   è ø€ ÒI¸D¤4¨¤:œŸš°4Ó7ÑIùs   ‚')r   Nz<must supply a tuple to get_group with multiple grouping keyszHmust supply a same-length tuple to get_group with multiple grouping keysc              3  ó.   •K  — | ]  } ‰|«      –— Œ y ­wrf   r„   )rÄ   rÀ   rÁ   s     €rj   rÆ   z)BaseGroupBy._get_index.<locals>.<genexpr>¦  s   øè ø€ ÒA¨q™-¨×*ÑAùs   ƒc              3  ó2   K  — | ]  \  }} ||«      –— Œ y ­wrf   r„   )rÄ   rs   Úns      rj   rÆ   z)BaseGroupBy._get_index.<locals>.<genexpr>§  s   è ø€ ÒM¡$ ! Q™˜1ŸÑMùs   ‚T©Ústrict)r7   r´   r~   r¾   rÃ   r¬   Útupler®   ÚnextÚiterÚ
ValueErrorÚKeyErrorÚzip)rh   r‚   Úindex_sampleÚmsgÚerrÚ
convertersÚ	converterrÁ   s          @rj   Ú
_get_indexzBaseGroupBy._get_index{  s1  ø€ ò	'ô �Œ:Ø—<‘<×#Ñ#¤B§F¡F¨BÓ/Ð/Ü�dœEÔ"ÜÑIÀDÔIÓIˆDäˆt�|‰|Ó˜qÒ Ü¤ T§\¡\Ó 2Ó3‰LàˆLä�l¤EÔ*Ü˜d¤EÔ*ØT�Ü  “oÐ%Ü�t“9¤ LÓ 1Ò1ð	3àŸ<™<¨Ñ-Ð-ó B°LÔAˆJÜÑM¬#¨j¸$ÀtÔ*LÔMÓM‰Dá% lÓ3ˆIÙ˜T“?ˆDà�|‰|×Ñ  bÓ)Ð)øô  ò 3ð6ð ô % S›/¨sÐ2ûð3ús   ÃD? Ä?	EÅEÅEc                óò   — t        | j                  t        «      r| j                  S | j                  �:t	        | j                  «      r| j                  | j                     S | j
                  S | j                  S rf   )r¬   r‘   rQ   Ú
_selectionr.   Ú_obj_with_exclusionsr£   s    rj   Ú_selected_objzBaseGroupBy._selected_obj®  s]   € ô �d—h‘h¤Ô'Ø—8‘8ˆOà�?‰?Ð&Ü˜4Ÿ?™?Ô+ð —x‘x §¡Ñ0Ð0ð
 ×,Ñ,Ð,à�x‰xˆrl   c                ó6   — | j                   j                  «       S rf   )r‘   Ú_dir_additionsr£   s    rj   rÝ   zBaseGroupBy._dir_additionsÃ  s   € à�x‰x×&Ñ&Ó(Ð(rl   c                 ó   — y rf   r„   ©rh   Úfuncrq   rr   s       rj   ÚpipezBaseGroupBy.pipeÇ  ó   € ð rl   c                 ó   — y rf   r„   rß   s       rj   rá   zBaseGroupBy.pipeÏ  râ   rl   c                ó6   — t        j                  | |g|¢­i |¤ŽS )a¼  
        Apply a ``func`` with arguments to this GroupBy object and return its result.

        Use `.pipe` when you want to improve readability by chaining together
        functions that expect Series, DataFrames, GroupBy or Resampler objects.
        Instead of writing

        >>> h = lambda x, arg2, arg3: x + 1 - arg2 * arg3
        >>> g = lambda x, arg1: x * 5 / arg1
        >>> f = lambda x: x**4
        >>> df = pd.DataFrame([["a", 4], ["b", 5]], columns=["group", "value"])
        >>> h(g(f(df.groupby("group")), arg1=1), arg2=2, arg3=3)  # doctest: +SKIP

        You can write

        >>> (
        ...     df.groupby("group").pipe(f).pipe(g, arg1=1).pipe(h, arg2=2, arg3=3)
        ... )  # doctest: +SKIP

        which is much more readable.

        Parameters
        ----------
        func : callable or tuple of (callable, str)
            Function to apply to this GroupBy object or, alternatively,
            a `(callable, data_keyword)` tuple where `data_keyword` is a
            string indicating the keyword of `callable` that expects the
            GroupBy object.
        *args : iterable, optional
            Positional arguments passed into `func`.
        **kwargs : dict, optional
            A dictionary of keyword arguments passed into `func`.

        Returns
        -------
        GroupBy
            The return type of `func`.

        See Also
        --------
        Series.pipe : Apply a function with arguments to a series.
        DataFrame.pipe : Apply a function with arguments to a dataframe.
        apply : Apply function to each group instead of to the
            full GroupBy object.

        Notes
        -----
        See more `here
        <https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#piping-function-calls>`_

        Examples
        --------
        >>> df = pd.DataFrame({"A": "a b a b".split(), "B": [1, 2, 3, 4]})
        >>> df
           A  B
        0  a  1
        1  b  2
        2  a  3
        3  b  4

        To get the difference between each groups maximum and minimum value in one
        pass, you can do

        >>> df.groupby("A").pipe(lambda x: x.max() - x.min())
           B
        A
        a  2
        b  2
        )Úcomrá   rß   s       rj   rá   zBaseGroupBy.pipe×  s    € ôV �x‰x˜˜dÐ4 TÒ4¨VÑ4Ð4rl   c                ót  — | j                   }| j                  }t        |«      rt        |«      dk(  st        |«      r=t        |«      dk(  r/t	        |t
        «      rt        |«      dk(  r|d   }nt        |«      ‚| j                  |«      }t        |«      st        |«      ‚| j                  j                  |   S )a–  
        Construct DataFrame from group with provided name.

        This method retrieves all rows belonging to a specific group identified
        by the given name.

        Parameters
        ----------
        name : object
            The name of the group to get as a DataFrame.

        Returns
        -------
        Series or DataFrame
            Get the respective Series or DataFrame corresponding to the group provided.

        See Also
        --------
        DataFrameGroupBy.groups: Dictionary representation of the groupings formed
            during a groupby operation.
        DataFrameGroupBy.indices: Provides a mapping of group rows to positions
            of the elements.
        SeriesGroupBy.groups: Dictionary representation of the groupings formed
            during a groupby operation.
        SeriesGroupBy.indices: Provides a mapping of group rows to positions
            of the elements.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, 3], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        dtype: int64
        >>> ser.groupby(level=0).get_group("a")
        a    1
        a    2
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["owl", "toucan", "eagle"]
        ... )
        >>> df
                a  b  c
        owl     1  2  3
        toucan  1  5  6
        eagle   7  8  9
        >>> df.groupby(by=["a"]).get_group((1,))
                a  b  c
        owl     1  2  3
        toucan  1  5  6

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 2, 3, 4],
        ...     index=pd.DatetimeIndex(
        ...         ["2023-01-01", "2023-01-15", "2023-02-01", "2023-02-15"]
        ...     ),
        ... )
        >>> ser
        2023-01-01    1
        2023-01-15    2
        2023-02-01    3
        2023-02-15    4
        dtype: int64
        >>> ser.resample("MS").get_group("2023-01-01")
        2023-01-01    1
        2023-01-15    2
        dtype: int64
        r©   r   )
r’   r”   r1   r®   r¬   rÌ   rÐ   r×   rÛ   Úiloc)rh   r‚   r’   r”   Úindss        rj   Ú	get_groupzBaseGroupBy.get_group$  sš   € ðb �y‰yˆØ—
‘
ˆä˜Ô¤C¨£J°!¢OÜ˜Ô¤3 t£9°¢>ô ˜$¤Ô&¬3¨t«9¸ª>Ø˜A‘w‘ä˜t“nÐ$à�‰˜tÓ$ˆÜ�4ŒyÜ˜4“.Ð Ø×!Ñ!×&Ñ& tÑ,Ð,rl   c                ó   — | j                   }| j                  }| j                  j                  | j                  «      }t        |«      rt        |«      dk(  st        |t        «      rt        |«      dk(  r	d„ |D «       }|S )a	  
        Groupby iterator.

        This method provides an iterator over the groups created by the ``resample``
        or ``groupby`` operation on the object. The method yields tuples where
        the first element is the label (group key) corresponding to each group or
        resampled bin, and the second element is the subset of the data that falls
        within that group or bin.

        Returns
        -------
        Iterator
            Generator yielding a sequence of (name, subsetted object)
            for each group.

        See Also
        --------
        Series.groupby : Group data by a specific key or column.
        DataFrame.groupby : Group DataFrame using mapper or by columns.
        DataFrame.resample : Resample a DataFrame.
        Series.resample : Resample a Series.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, 3], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        dtype: int64
        >>> for x, y in ser.groupby(level=0):
        ...     print(f"{x}\n{y}\n")
        a
        a    1
        a    2
        dtype: int64
        b
        b    3
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]]
        >>> df = pd.DataFrame(data, columns=["a", "b", "c"])
        >>> df
           a  b  c
        0  1  2  3
        1  1  5  6
        2  7  8  9
        >>> for x, y in df.groupby(by=["a"]):
        ...     print(f"{x}\n{y}\n")
        (1,)
           a  b  c
        0  1  2  3
        1  1  5  6
        (7,)
           a  b  c
        2  7  8  9

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 2, 3, 4],
        ...     index=pd.DatetimeIndex(
        ...         ["2023-01-01", "2023-01-15", "2023-02-01", "2023-02-15"]
        ...     ),
        ... )
        >>> ser
        2023-01-01    1
        2023-01-15    2
        2023-02-01    3
        2023-02-15    4
        dtype: int64
        >>> for x, y in ser.resample("MS"):
        ...     print(f"{x}\n{y}\n")
        2023-01-01 00:00:00
        2023-01-01    1
        2023-01-15    2
        dtype: int64
        2023-02-01 00:00:00
        2023-02-01    3
        2023-02-15    4
        dtype: int64
        r©   c              3  ó,   K  — | ]  \  }}|f|f–— Œ y ­wrf   r„   )rÄ   rp   Úgroups      rj   rÆ   z'BaseGroupBy.__iter__.<locals>.<genexpr>è  s   è ø€ Ò?©*¨#¨u˜�v˜u”oÑ?ùs   ‚)	r’   r”   rœ   Úget_iteratorrÛ   r1   r®   r¬   r­   )rh   r’   r”   Úresults       rj   Ú__iter__zBaseGroupBy.__iter__†  si   € ðt �y‰yˆØ—
‘
ˆØ—‘×+Ñ+¨D×,>Ñ,>Ó?ˆä˜Ô¤C¨£J°!¢OÜ�tœTÔ"¤s¨4£y°A¢~ñ @¸Ô?ˆFØˆrl   )r‡   Úint)r‡   rŠ   )r‡   zdict[Hashable, Index])r‡   z$dict[Hashable, npt.NDArray[np.intp]])r‡   zset[str])rà   z!Callable[Concatenate[Self, P], T]rq   zP.argsrr   zP.kwargsr‡   r[   )rà   ztuple[Callable[..., T], str]rq   rX   rr   rX   r‡   r[   )rà   z@Callable[Concatenate[Self, P], T] | tuple[Callable[..., T], str]rq   rX   rr   rX   r‡   r[   ©r‡   úDataFrame | Series)r‡   z#Iterator[tuple[Hashable, NDFrameT]])rt   r‹   rŒ   rC   Ú_hidden_attrsÚ__annotations__r’   r”   r   r¤   r§   Úpropertyr±   r¢   r´   r×   r(   rÛ   rÝ   r   rá   ré   rï   r„   rl   rj   r�   r�   Æ   sÒ  … Ø ×.Ñ.ò 2ñ €Mð ÓØ $€DÐ
Ó$Ø#€EÐÓ#ØÓà
ò%ó ð%ð ò%ó ð%ð ØòI$ó ó ðI$ðV Øò%ó ó ð%ð ØòC%ó ó ðC%ðJ ñ0*ó ð0*ðd Øñó ó ðð& ò)ó ð)ð ðà/ðð ðð ð	ð
 
òó ðð ðà*ðð ðð ð	ð
 
òó ððK5àNðK5ð ðK5ð ð	K5ð
 
óK5ðZ ò_-ó ð_-ðB òbó ñbrl   r�   ÚOutputFrameOrSeries)Úboundc                  ól  — e Zd ZU dZded<   ded<   e	 	 	 	 	 	 	 	 	 	 dP	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dQd„«       ZdRd„ZedSd	„«       Ze	 	 dT	 	 	 dUd„«       Z	e	 	 	 	 dVd„«       Z
e	 dW	 	 	 	 	 dXd„«       Ze	 dW	 	 	 dYd„«       Z	 	 dT	 	 	 	 	 dZd„Zed[d„«       Z	 	 	 	 	 	 d\d„Zeddœd„«       Zeddœd„«       Zd
dœd]d„Ze	 	 d^	 	 	 	 	 	 	 	 	 d_d„«       Zed`d„«       Z	 	 	 	 	 	 	 	 	 	 dad„Ze	 	 	 db	 	 	 	 	 	 	 dcd„«       Zddded„Zedddœd„«       Zedddœd„«       Zedfd„«       Zed „ «       Zedgdhd!„«       Zeedid"„«       «       Zedgdjd#„«       Zedgdjd$„«       Z edkd%„«       Z!e	 	 	 	 dl	 	 	 	 	 	 	 dmd&„«       Z"edndod'„«       Z#e	 	 	 	 	 dp	 	 	 	 	 	 	 	 	 dqd)„«       Z$e	 	 	 	 	 dp	 	 	 	 	 	 	 	 	 dqd*„«       Z%e	 	 	 	 	 dr	 	 	 	 	 	 	 	 	 	 	 dsd+„«       Z&e	 dt	 	 	 	 	 	 	 dud,„«       Z'edvd-„«       Z(e	 	 	 	 	 dw	 	 	 	 	 	 	 	 	 dxd.„«       Z)e	 dy	 	 	 	 	 	 	 dzd/„«       Z*e	 	 	 	 	 d{	 	 	 	 	 	 	 	 	 dxd0„«       Z+e	 	 	 	 	 d{	 	 	 	 	 	 	 	 	 dxd1„«       Z,e	 d|	 	 	 	 	 	 	 dzd2„«       Z-e	 d|	 	 	 	 	 	 	 dzd3„«       Z.ed}d4„«       Z/	 	 	 d~	 dkd5„Z0e	 	 	 	 	 	 	 dd
dœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d€d6„«       Z1e	 	 	 	 	 	 d�	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d‚d7„«       Z2e	 	 dƒ	 	 	 	 	 d„d8„«       Z3e	 	 	 	 	 	 	 	 	 d…	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d†d9„«       Z4edWd‡d:„«       Z5edWdˆd;„«       Z6edWdˆd<„«       Z7eed‰d=„«       «       Z8	 dW	 	 	 	 	 dŠd>„Z9e	 	 	 d‹	 	 	 	 	 dŒd?„«       Z:edgd�d@„«       Z;edgd�dA„«       Z<e	 	 	 	 dŽ	 	 	 	 	 	 	 	 	 d�dB„«       Z=e	 	 dn	 	 	 	 	 dodC„«       Z>e	 	 dn	 	 	 	 	 dodD„«       Z?e	 	 dn	 	 	 	 	 dodE„«       Z@e	 	 dn	 	 	 	 	 dodF„«       ZAed(deBj†                  df	 	 	 d�dG„«       ZDe	 d‘	 	 	 d’dH„«       ZEe	 	 	 d“	 	 	 d”dI„«       ZFed•d–dJ„«       ZGed•d–dK„«       ZHed—dL„«       ZIe	 	 	 	 	 d˜	 	 	 	 	 	 	 	 	 d™dM„«       ZJ	 	 	 dš	 	 	 	 	 	 	 	 	 d›dN„ZK	 	 	 	 	 	 	 	 dœdO„ZLy)�r†   at  
    Class for grouping and aggregating relational data.

    See aggregate, transform, and apply functions on this object.

    It's easiest to use obj.groupby(...) to use GroupBy, but you can also do:

    ::

        grouped = groupby(obj, ...)

    Parameters
    ----------
    obj : pandas object
    level : int, default None
        Level of MultiIndex
    groupings : list of Grouping objects
        Most users should ignore this
    exclusions : array-like, optional
        List of columns to exclude
    name : str
        Most users should ignore this

    Returns
    -------
    **Attributes**
    groups : dict
        {group name -> group labels}
    len(grouped) : int
        Number of groups

    Notes
    -----
    After grouping, see aggregate, apply, and transform functions. Here are
    some other brief notes about usage. When grouping by multiple groups, the
    result index will be a MultiIndex (hierarchical) by default.

    Iteration produces (key, group) tuples, i.e. chunking the data by group. So
    you can write code like:

    ::

        grouped = obj.groupby(keys)
        for key, group in grouped:
            # do something with the data

    Function calls on GroupBy, if not specially implemented, "dispatch" to the
    grouped data. So if you group a DataFrame and wish to invoke the std()
    method on each group, you can simply do:

    ::

        df.groupby(mapper).std()

    rather than

    ::

        df.groupby(mapper).aggregate(np.std)

    You can pass arguments to these "wrapped" functions, too.

    See the online documentation for full exposition on these topics and much
    more
    r›   rœ   rŸ   r—   Nc                óV  — || _         t        |t        «      sJ t        |«      «       ‚|| _        || _        || _        || _        |	| _        || _	        |€t        |||||
| j                  ¬«      \  }}}|
| _        || _        || _        |rt        |«      | _        y t        «       | _        y )N)r”   r“   r˜   r•   )rÙ   r¬   rF   Útyper”   r—   r’   r“   rš   r•   rJ   r˜   r‘   rœ   Ú	frozensetr™   )rh   r‘   r’   r”   r–   r™   Ú	selectionr—   r“   rš   r˜   r•   s               rj   rk   zGroupBy.__init__6  s§   € ð $ˆŒä˜#œwÔ'Ð2¬¨c«Ó2Ð'àˆŒ
Ø ˆŒØˆŒ	ØˆŒ	Ø$ˆŒØˆŒàˆ?Ü'2ØØØØØ!Ø—{‘{ô(Ñ$ˆG�Z ð !ˆŒØˆŒØˆŒÙ3=œ) JÓ/ˆ�Ä9Ã;ˆ�rl   c                óº   — || j                   v rt        j                  | |«      S || j                  v r| |   S t	        dt        | «      j                  › d|› d�«      ‚)Nú'z' object has no attribute ')Ú_internal_names_setr¦   Ú__getattribute__r‘   ÚAttributeErrorrú   rt   )rh   rƒ   s     rj   r…   zGroupBy.__getattr___  sd   € Ø�4×+Ñ+Ñ+Ü×*Ñ*¨4°Ó6Ð6Ø�4—8‘8ÑØ˜‘:ÐäØ”�T“
×#Ñ#Ð$Ð$?À¸vÀQÐGó
ð 	
rl   c                ód  ‡‡‡— t        t        | j                  «      |«      Šdˆˆˆfd„	}||_        |t        j
                  v r| j                  |«      S |t        j                  v }| j                  || j                  || ¬«      }| j                  j                  r|r| j                  |«      }|S )z<Compute the result of an operation by using GroupBy's apply.c                ó   •—  ‰| g‰¢­i ‰¤ŽS rf   r„   )Úxrp   rq   rs   rr   s     €€€rj   Úcurriedz&GroupBy._op_via_apply.<locals>.curriedn  s   ø€ Ù�QÐ(˜Ò( Ñ(Ð(rl   )Úis_transformÚnot_indexed_samerf   )r€   rú   rÚ   rt   rG   Úplotting_methodsru   Útransformation_kernelsÚ_python_apply_generalrœ   Úhas_dropped_naÚ_set_result_index_ordered)rh   r‚   rq   rr   r  r  rî   rs   s     ``   @rj   Ú_op_via_applyzGroupBy._op_via_applyi  s®   ú€ ô ”D˜×2Ñ2Ó3°TÓ:ˆ÷	)ð
  ˆÔð ”4×(Ñ(Ñ(Ø×*Ñ*¨7Ó3Ð3àœt×:Ñ:Ð:ˆØ×+Ñ+ØØ×%Ñ%Ø%Ø!-Ð-ð	 ,ó 
ˆð �=‰=×'Ò'©Lð ×3Ñ3°FÓ;ˆFØˆrl   Fc                óÜ  — ddl m} | j                  rj|sh| j                  rQ| j                  j
                  }| j                  j                  }| j                  j                  } ||d|||d¬«      }nò ||d¬«      }nç|sÛ ||d¬«      }| j                  j                  }	| j                  r | j                  j                  }
|
dk7  }|	|   }	|	j                  ro|j                  d   j                  |	«      sQt        j                   |	j"                  «      }|j                  j%                  |«      \  }}|j'                  |d¬«      }n|j)                  |	d¬«      }n
 ||d¬«      }| j*                  j,                  dk(  r| j*                  j.                  }n$t1        | j2                  «      r| j2                  }nd }t5        |t6        «      r	|�||_        |j9                  | j*                  d¬	«      S )
Nr   ©ÚconcatF)Úaxisr’   ÚlevelsÚnamesr“   ©r  éÿÿÿÿr©   ri   ©Úmethod)Úpandas.core.reshape.concatr  rš   r—   rœ   Úresult_indexr  r  rÛ   Úindexr•   ÚidsÚhas_duplicatesÚaxesÚequalsr:   Úunique1dÚ_valuesÚget_indexer_non_uniqueÚtakeÚreindexr‘   Úndimr‚   r.   rÙ   r¬   rQ   Ú__finalize__)rh   Úvaluesr  r  r  rš   Úgroup_levelsÚgroup_namesrî   ÚaxÚlabelsÚmaskÚtargetÚindexerÚ_r‚   s                   rj   Ú_concat_objectszGroupBy._concat_objects‹  s›  € õ 	6à�?Š?¡<Ø�}Š}à!Ÿ]™]×7Ñ7�
Ø#Ÿ}™}×3Ñ3�Ø"Ÿm™m×1Ñ1�áØØØ#Ø'Ø%Øô‘ñ   ¨QÔ/‘á!Ù˜F¨Ô+ˆFà×#Ñ#×)Ñ)ˆBØ�{Š{ØŸ™×*Ñ*�Ø ‘|�Ø˜‘X�ð × Ò ¨¯©°Q©×)>Ñ)>¸rÔ)Bä#×,Ñ,¨R¯Z©ZÓ8�Ø#Ÿ\™\×@Ñ@ÀÓH‘
�˜ØŸ™ W°1˜Ó5‘àŸ™¨°˜Ó3‘ñ ˜F¨Ô+ˆFà�8‰8�=‰=˜AÒØ—8‘8—=‘=‰DÜ˜Ÿ™Ô)Ø—?‘?‰DàˆDä�fœfÔ%¨$Ð*:ØˆFŒKà×"Ñ" 4§8¡8°IÐ"Ó>Ð>rl   c                óÜ  — | j                   j                  }| j                  j                  r+| j                  j                  s|j                  |d¬«      }|S t        | j                  j                  d¬«      }|j                  |d¬«      }|j                  d¬«      }| j                  j                  r%|j                  t        t        |«      «      d¬«      }|j                  |d¬«      }|S )Nr   r  F©r}   )r‘   r  rœ   Úis_monotonicr  Úset_axisrM   Úresult_ilocsÚ
sort_indexr#  rO   r®   )rh   rî   r  Úoriginal_positionss       rj   r  z!GroupBy._set_result_index_orderedÌ  sÁ   € ð —‘—‘ˆà�=‰=×%Ò%¨d¯m©m×.JÒ.Jà—_‘_ U°�_Ó3ˆFØˆMô # 4§=¡=×#=Ñ#=ÀEÔJÐØ—‘Ð!3¸!�Ó<ˆØ×"Ñ"¨Ð"Ó*ˆØ�=‰=×'Ò'ð —^‘^¤M´#°e³*Ó$=ÀA�^ÓFˆFØ—‘ ¨Q�Ó/ˆàˆrl   c                óÒ  ‡— t        ‰t        «      r‰j                  «       Št        | j                  j
                  «      }d
ˆfd„}|�E‰j                  d |d|› �«      t        j                  |t        ‰«      t        |«      z  «      «       t        t        t        | j                  j                  «      | j                  j                  «       d¬«      «      D ]Š  \  }\  }}|€|dk(  r|€dn
d||z
  dz
  › �}|‰j                  vsŒ.|€‰j                  d ||«      |«       ŒJ‰j                  d ||«      t        t        j                   |t        |«      «      d¬	«      «       ŒŒ ‰S )Nc                óœ   •— t        ‰j                  t        «      r0t        | t        «      s | fd‰j                  j                  dz
  z  z   S | S )N)Ú r©   )r¬   ÚcolumnsrN   rÌ   Únlevels)r‚   rî   s    €rj   Úfull_keyz0GroupBy._insert_inaxis_grouper.<locals>.full_keyï  sB   ø€ ô ˜&Ÿ.™.¬*Ô5¼jÈÌuÔ>UØ�w ¨&¯.©.×*@Ñ*@À1Ñ*DÑ!EÑEÐEØˆKrl   r   Úlevel_TrÊ   r©   r  Fr1  )r‚   r   r‡   r   )r¬   rQ   Úto_framer®   rœ   Ú	groupingsÚinsertr¾   ÚtileÚ	enumeraterÑ   Úreversedr  Úget_group_levelsr:  rM   Úrepeat)rh   rî   ÚqsÚn_groupingsr<  r”   r‚   Úlevs    `      rj   Ú_insert_inaxis_grouperzGroupBy._insert_inaxis_grouperæ  sP  ø€ ô �fœfÔ%Ø—_‘_Ó&ˆFä˜$Ÿ-™-×1Ñ1Ó2ˆõ	ð ˆ>Ø�M‰MØ‘8˜f [ MÐ2Ó3´R·W±W¸RÄÀVÃÔPSÐTVÓPWÑAWÓ5Xôô
 #,ÜÜ˜Ÿ™×,Ñ,Ó-Ø—‘×.Ñ.Ó0Øôó#
ò 	ÑˆE‘;�D˜#ð ˆ|ð # aÒ'¨B¨Jñ à! +°Ñ"5¸Ñ"9Ð!:Ð;ð ð ˜6Ÿ>™>Ò)à�:Ø—M‘M !¡X¨d£^°SÕ9à—M‘MØ™8 D›>¬5´·±¸3ÄÀBÃÓ1HÈuÔ+Uõð-	ð4 ˆrl   c                óð   — | j                   s>| j                  ||¬«      }|j                  «       }t        t	        |«      «      |_        |S | j                  j                  }|�t        ||«      }||_        |S )zÛ
        Wraps the output of GroupBy aggregations into the expected result.

        Parameters
        ----------
        result : Series, DataFrame

        Returns
        -------
        Series or DataFrame
        ©rF  )	r—   rI  Ú_consolidaterO   r®   r  rœ   r  Ú_insert_quantile_level)rh   rî   rF  r  s       rj   Ú_wrap_aggregated_outputzGroupBy._wrap_aggregated_output  sw   € ð( �}Š}ð ×0Ñ0°¸BÐ0Ó?ˆFØ×(Ñ(Ó*ˆFÜ(¬¨V«Ó5ˆFŒLð ˆð —M‘M×.Ñ.ˆEØˆ~ô /¨u°bÓ9�Ø ˆFŒLàˆrl   c                ó   — t        | «      ‚rf   ©r%   )rh   Údatar&  r  r  s        rj   Ú_wrap_applied_outputzGroupBy._wrap_applied_output=  s   € ô " $Ó'Ð'rl   c                ó>  — | j                   j                  }| j                   j                  }| j                   j                  }|j	                  |d¬«      j                  «       }|j                  }t        |t        «      rat        | j                   j                  «      dkD  rt        d«      ‚| j                   j                  d   j                  }|j                  |«      }|j	                  |«      j                  «       }t        j                  ||«      \  }	}
|	|
||fS )Nr   r  r©   z_Grouping with more than 1 grouping labels and a MultiIndex is not supported with engine='numba')rœ   r¢   r4  Ú_sorted_idsr"  Úto_numpyr  r¬   rN   r®   r?  ÚNotImplementedErrorr‚   Úget_level_valuesr   Úgenerate_slices)rh   rQ  r¢   Úsorted_indexÚ
sorted_idsÚsorted_dataÚ
index_dataÚ	group_keyÚsorted_index_dataÚstartsÚendss              rj   Ú_numba_prepzGroupBy._numba_prepI  s÷   € à—-‘-×'Ñ'ˆØ—}‘}×1Ñ1ˆØ—]‘]×.Ñ.ˆ
à—i‘i °1�iÓ5×>Ñ>Ó@ˆà—Z‘Zˆ
Ü�j¤*Ô-Ü�4—=‘=×*Ñ*Ó+¨aÒ/Ü)ðHóð ð Ÿ™×/Ñ/°Ñ2×7Ñ7ˆIØ#×4Ñ4°YÓ?ˆJØ&ŸO™O¨LÓ9×BÑBÓDÐä×*Ñ*¨:°wÓ?‰ˆ�àØØØð	
ð 	
rl   c                óp  — | j                   st        d«      ‚| j                  }|j                  dk(  r|n|j	                  «       }t        j                  ||dfi t        |«      ¤Ž}| j                  j                  }| j                  j                  }	 |j                  j                  |f||	dœ|¤Ž}
| j                  j                  |
j                  d<   |j                  |
|
j                  ¬«      }|j                  dk(  r$|j!                  d«      }|j"                  |_        |S |j$                  |_        |S )zp
        Perform groupby with a standard numerical aggregation function (e.g. mean)
        with Numba.
        z<as_index=False is not supported. Use .reset_index() instead.é   T)r*  r¢   r©   )r  r:  )r—   rV  rÚ   r$  r>  r<   Úgenerate_shared_aggregatorrS   rœ   r  r¢   Ú_mgrÚapplyr  r  Ú_constructor_from_mgrÚsqueezer‚   r:  )rh   rà   Údtype_mappingÚengine_kwargsÚaggregator_kwargsrQ  ÚdfÚ
aggregatorr  r¢   Úres_mgrrî   s               rj   Ú_numba_agg_generalzGroupBy._numba_agg_generald  s  € ð �}Š}Ü%ØNóð ð ×(Ñ(ˆØ—Y‘Y !’^‰T¨¯©«ˆä×8Ñ8ØØØñ
ô   Ó.ñ	
ˆ
ð �m‰m×ÑˆØ—-‘-×'Ñ'ˆà�"—'‘'—-‘-Øð
Ø"¨Gñ
Ø7Hñ
ˆð Ÿ-™-×4Ñ4ˆ�‰�Q‰Ø×)Ñ)¨'¸¿¹Ð)ÓEˆà�9‰9˜Š>Ø—^‘^ IÓ.ˆFØŸ)™)ˆFŒKð ˆð "Ÿ\™\ˆFŒNØˆrl   )rj  c          	     ó†  — | j                   }| j                  j                  }|j                  dk(  r|n|j	                  «       }| j                  |«      \  }}	}
}t        j                  |«       t        |||d¬«      \  }}t        j                  |fi t        |«      ¤Ž} |||
||	t        |j                  «      g|¢­Ž }|j                  t        j                  |«      d¬«      }|j                   }|j                  dk(  rd|j"                  i}|j%                  «       }nd|j                  i} |j&                  |fd|i|¤ŽS )	a(  
        Perform groupby transform routine with the numba engine.

        This routine mimics the data splitting routine of the DataSplitter class
        to generate the indices of each group in the sorted data and then passes the
        data and indices into a Numba jitted function.
        rc  ©Únum_required_argsr   r  r©   r‚   r:  r  )rÚ   rœ   r4  r$  r>  ra  rH   Úvalidate_udfrU   Úgenerate_numba_transform_funcrS   r®   r:  r"  r¾   Úargsortr  r‚   ÚravelÚ_constructor)rh   rà   rj  rq   rr   rQ  Úindex_sortingrl  r_  r`  rY  r[  Únumba_transform_funcrî   r  Úresult_kwargss                   rj   Ú_transform_with_numbazGroupBy._transform_with_numba�  s8  € ð ×(Ñ(ˆØŸ™×2Ñ2ˆØ—Y‘Y !’^‰T¨¯©«ˆà26×2BÑ2BÀ2Ó2FÑ/ˆ��l KÜ×Ñ˜DÔ!Ü1Ø�$˜°!ô
‰ˆˆfô  &×CÑCØñ 
Ü% mÓ4ñ 
Ðñ &ØØØØÜ�—
‘
‹Oð
ð ò
ˆð —‘œRŸZ™Z¨Ó6¸Q�Ó?ˆØ—
‘
ˆØ�9‰9˜Š>Ø# T§Y¡YÐ/ˆMØ—\‘\“^‰Fà&¨¯©Ð5ˆMØ ˆt× Ñ  ÑF¨uÐF¸ÑFÐFrl   c          	     ó’  — | j                   }|j                  dk(  r|n|j                  «       }| j                  |«      \  }}}	}
t	        j
                  |«       t        |||d¬«      \  }}t	        j                  |fi t        |«      ¤Ž} ||
|	||t        |j                  «      g|¢­Ž }| j                  j                  }|j                  dk(  rd|j                  i}|j                  «       }nd|j                  i} |j                  |fd|i|¤Ž}| j                   s*| j#                  |«      }t%        t        |«      «      |_        |S )a*  
        Perform groupby aggregation routine with the numba engine.

        This routine mimics the data splitting routine of the DataSplitter class
        to generate the indices of each group in the sorted data and then passes the
        data and indices into a Numba jitted function.
        rc  rq  r©   r‚   r:  r  )rÚ   r$  r>  ra  rH   rs  rU   Úgenerate_numba_agg_funcrS   r®   r:  rœ   r  r‚   rv  rw  r—   rI  rO   r  )rh   rà   rj  rq   rr   rQ  rl  r_  r`  rY  r[  Únumba_agg_funcrî   r  rz  Úress                   rj   Ú_aggregate_with_numbazGroupBy._aggregate_with_numba·  s>  € ð ×(Ñ(ˆØ—Y‘Y !’^‰T¨¯©«ˆà26×2BÑ2BÀ2Ó2FÑ/ˆ��l KÜ×Ñ˜DÔ!Ü1Ø�$˜°!ô
‰ˆˆfô  ×7Ñ7Øñ
Ü% mÓ4ñ
ˆñ  ØØØØÜ�—
‘
‹Oð
ð ò
ˆð —‘×*Ñ*ˆØ�9‰9˜Š>Ø# T§Y¡YÐ/ˆMØ—\‘\“^‰Fà&¨¯©Ð5ˆMØˆd×Ñ ÑE¨eÐE°}ÑEˆØ�}Š}Ø×-Ñ-¨cÓ2ˆCÜ%¤c¨#£hÓ/ˆCŒIØˆ
rl   )Úinclude_groupsc               óz  ‡‡‡— |rt        d«      ‚t        ‰t        «      rNt        | ‰«      r3t	        | ‰«      }t        |«      r |‰i ‰¤ŽS ‰s‰rt        d‰› �«      ‚|S t        d‰› d�«      ‚‰s‰r,t        ‰«      rt        ‰«      ˆˆˆfd„«       }nt        d«      ‚‰}| j                  || j                  «      S )aS  
        Apply function ``func`` group-wise and combine the results together.

        The function passed to ``apply`` must take a dataframe as its first
        argument and return a DataFrame, Series or scalar. ``apply`` will
        then take care of combining the results back together into a single
        dataframe or series. ``apply`` is therefore a highly flexible
        grouping method.

        While ``apply`` is a very flexible method, its downside is that
        using it can be quite a bit slower than using more specific methods
        like ``agg`` or ``transform``. Pandas offers a wide range of method that will
        be much faster than using ``apply`` for their specific purposes, so try to
        use them before reaching for ``apply``.

        Parameters
        ----------
        func : callable
            A callable that takes a dataframe as its first argument, and
            returns a dataframe, a series or a scalar. In addition the
            callable may take positional and keyword arguments.

        *args : tuple
            Optional positional arguments to pass to ``func``.

        include_groups : bool, default False
            When True, will attempt to apply ``func`` to the groupings in
            the case that they are columns of the DataFrame. If this raises a
            TypeError, the result will be computed with the groupings excluded.
            When False, the groupings will be excluded when applying ``func``.

            .. versionadded:: 2.2.0

            .. versionchanged:: 3.0.0

            The default changed from True to False, and True is no longer allowed.

        **kwargs : dict
            Optional keyword arguments to pass to ``func``.

        Returns
        -------
        Series or DataFrame
            A pandas object with the result of applying ``func`` to each group.

        See Also
        --------
        pipe : Apply function to the full GroupBy object instead of to each
            group.
        aggregate : Apply aggregate function to the GroupBy object.
        transform : Apply function column-by-column to the GroupBy object.
        Series.apply : Apply a function to a Series.
        DataFrame.apply : Apply a function to each row or column of a DataFrame.

        Notes
        -----
        See :ref:`groupby.apply` in the User Guide for more details and examples.

        The resulting dtype will reflect the return value of the passed ``func``,
        see the examples below.

        Functions that mutate the passed object can produce unexpected
        behavior or errors and are not supported. See :ref:`gotchas.udf-mutation`
        for more details.

        Each group passed to ``func`` has a ``name`` attribute set to the group
        key (the value of the grouping for that group). This is useful for
        identifying the current group, for example when grouping by an external
        grouper rather than by a column of the object.

        Examples
        --------
        >>> df = pd.DataFrame({"A": "a a b".split(), "B": [1, 2, 3], "C": [4, 6, 5]})
        >>> g1 = df.groupby("A", group_keys=False)
        >>> g2 = df.groupby("A", group_keys=True)

        Notice that ``g1`` and ``g2`` have two groups, ``a`` and ``b``, and only
        differ in their ``group_keys`` argument. Calling `apply` in various ways,
        we can get different grouping results:

        Example 1: below the function passed to `apply` takes a DataFrame as
        its argument and returns a DataFrame. `apply` combines the result for
        each group together into a new DataFrame:

        >>> g1[["B", "C"]].apply(lambda x: x / x.sum())
                  B    C
        0  0.333333  0.4
        1  0.666667  0.6
        2  1.000000  1.0

        In the above, the groups are not part of the index. We can have them included
        by using ``g2`` where ``group_keys=True``:

        >>> g2[["B", "C"]].apply(lambda x: x / x.sum())
                    B    C
        A
        a 0  0.333333  0.4
          1  0.666667  0.6
        b 2  1.000000  1.0

        Example 2: The function passed to `apply` takes a DataFrame as
        its argument and returns a Series.  `apply` combines the result for
        each group together into a new DataFrame.

        The resulting dtype will reflect the return value of the passed ``func``.

        >>> g1[["B", "C"]].apply(lambda x: x.astype(float).max() - x.min())
             B    C
        A
        a  1.0  2.0
        b  0.0  0.0

        >>> g2[["B", "C"]].apply(lambda x: x.astype(float).max() - x.min())
             B    C
        A
        a  1.0  2.0
        b  0.0  0.0

        The ``group_keys`` argument has no effect here because the result is not
        like-indexed (i.e. :ref:`a transform <groupby.transform>`) when compared
        to the input.

        Example 3: The function passed to `apply` takes a DataFrame as
        its argument and returns a scalar. `apply` combines the result for
        each group together into a Series, including setting the index as
        appropriate:

        >>> g1.apply(lambda x: x.C.max() - x.B.min())
        A
        a    5
        b    2
        dtype: int64

        Example 4: The function passed to ``apply`` returns ``None`` for one of the
        group. This group is filtered from the result:

        >>> g1.apply(lambda x: None if x.iloc[0, 0] == 3 else x)
           B  C
        0  1  4
        1  2  6
        ú)include_groups=True is no longer allowed.z"Cannot pass arguments to property z$apply func should be callable, not 'rþ   c                ó   •—  ‰| g‰¢­i ‰¤ŽS rf   r„   )Úgrq   rà   rr   s    €€€rj   rs   zGroupBy.apply.<locals>.f�  s   ø€ á Ð3 DÒ3¨FÑ3Ð3rl   z6func must be a callable if args or kwargs are supplied)
rÏ   r¬   rŠ   Úhasattrr€   ÚcallableÚ	TypeErrorr   r
  rÚ   )rh   rà   r�  rq   rr   r  rs   s    ` ``  rj   rf  zGroupBy.applyâ  sÔ   ú€ ñ\ ÜÐHÓIÐIÜ�dœCÔ Ü�t˜TÔ"Ü˜d DÓ)�Ü˜C”=Ù Ð/¨Ñ/Ð/Ù™VÜ$Ð'IÈ$ÈÐ%PÓQÐQØ�
ô  Ð"FÀtÀfÈAÐ NÓOÐOá‘VÜ˜Œ~ä�t“õ4ó ñ4ô !ØLóð ð ˆAà×)Ñ)¨!¨T×-FÑ-FÓGÐGrl   c                óp   — | j                   j                  ||«      \  }}|€|}| j                  ||||«      S )aê  
        Apply function f in python space

        Parameters
        ----------
        f : callable
            Function to apply
        data : Series or DataFrame
            Data to apply f to
        not_indexed_same: bool, optional
            When specified, overrides the value of not_indexed_same. Apply behaves
            differently when the result index is equal to the input index, but
            this can be coincidental leading to value-dependent behavior.
        is_transform : bool, default False
            Indicator for whether the function is actually a transform
            and should not have group keys prepended.

        Returns
        -------
        Series or DataFrame
            data after applying f
        )rœ   Úapply_groupwiserR  )rh   rs   rQ  r  r  r&  Úmutateds          rj   r
  zGroupBy._python_apply_generalŽ  sI   € ð< Ÿ-™-×7Ñ7¸¸4Ó@‰ˆ�ØÐ#Ø&Ðà×(Ñ(ØØØØó	
ð 	
rl   c                óè   — | j                   }g }| j                  j                  |«      D ]3  \  }}|j                  dk(  r||_        |j                   |||«      «       Œ5 | j                  ||d¬«      S )a_  
        Apply a plotting function f group-wise.

        Each Series group gets its group key as the name, which plotting
        methods use for legend labels. Unlike the general apply path, this
        labels the group explicitly rather than relying on the name attribute
        being pinned to the group key as a side effect (GH#41090).
        r©   T©r  )rÛ   rœ   rí   r$  r‚   ÚappendrR  )rh   rs   rQ  r&  rp   rì   s         rj   ru   zGroupBy._python_apply_plot·  st   € ð ×!Ñ!ˆØˆØŸ-™-×4Ñ4°TÓ:ò 	)‰JˆC�Ø�z‰z˜QŠØ �”
Ø�M‰M™!˜E 3›-Õ(ð	)ð ×(Ñ(¨¨vÈÐ(ÓMÐMrl   c                óJ  — |€J ‚|j                   dk(  rt        |d¬«      }nHt        |j                  |j                  ¬«      }|j
                  d   dk(  sJ ‚|j                  dd…df   }	 | j                  j                  ||«      }|j                  }
|
t        k(  r|j                  t        d¬«      }n.t        |
«      r#|
j                  «       }|j                  ||
¬«      }t!        ||¬
«      S # t        $ r*}d|› d|j                  › d	�}	 t        |«      |	«      |‚d}~ww xY w)zn
        Fallback to pure-python aggregation if _cython_operation raises
        NotImplementedError.
        Nr©   Fr1  ©Údtyper   zagg function failed [how->z,dtype->ú])r$  )r$  rQ   rE   r[   r‘  Úshaperç   rœ   Ú
agg_seriesÚ	Exceptionrú   r¦   Úastyper5   Úconstruct_array_typeÚ_from_sequencerP   )rh   Úhowr&  r$  ÚaltÚserrl  Ú
res_valuesrÔ   rÓ   r‘  Ústring_array_clss               rj   Ú_agg_py_fallbackzGroupBy._agg_py_fallbackË  s   € ð ˆÐˆà�;‰;˜!Òä˜ eÔ,‰Cô ˜6Ÿ8™8¨6¯<©<Ô8ˆBð —8‘8˜A‘; !Ò#Ð#Ð#ð —'‘'š!˜Q˜$‘-ˆCð
	*ØŸ™×1Ñ1°#°sÓ;ˆJð —	‘	ˆØ”FŠ?Ø#×*Ñ*¬6¸Ð*Ó>‰JÜ˜UÔ#à$×9Ñ9Ó;ÐØ)×8Ñ8¸È5Ð8ÓQˆJô " *°4Ô8Ð8øô# ò 	*Ø.¨s¨e°8¸C¿I¹I¸;ÀaÐHˆCà”$�s“)˜C“. cÐ)ûð	*ús   Á+C/ Ã/	D"Ã8%DÄD"c                óL  ‡ ‡‡‡‡‡
— t        |«      st        d«      ‚‰ j                  |‰¬«      Š
d	ˆˆ
ˆˆˆˆ fd„}‰
j                  |«      }‰ j	                  |«      }‰dv r‰ j                  |‰‰d   ¬«      }‰ j                  |«      }	|	j                  ‰ j                  d¬«      S )
Nz(numeric_only accepts only Boolean values©Únumeric_onlyr‚   c                ót  •— ‰dv xr" | j                   t        j                   d«      k(  }|r
‰dk(  rdnd}n‰}	  ‰j                  j                  | |f‰j                  dz
  ‰
dœ‰	¤Ž}|rr|j                   j
                  dk(  rY‰dk(  rd	nd
}t        j                  t        j                  |«      |t        j                  |«      «      j                  t        «      }|S # t        $ r,}‰�‰dv rt        ‰› d| j                   › d�«      |‚Y d }~nd }~ww xY w‰€J ‚‰j                  ‰| ‰j                  ‰¬«      }|S )N©ÚanyÚallrŸ   r¤  ÚmaxÚminr©   ©r  Ú	min_countrs   ç        g      ð?)r¤  r¥  ÚstdÚsemz is not supported for z dtype)r$  rš  )r‘  r¾   rœ   Ú_cython_operationr$  ÚkindÚwhereÚisnanÚasarrayr–  rŸ   rV  rˆ  rž  )r&  Úuse_bool_fastpathÚ_howrî   ÚfillrÔ   rš  rQ  r™  rr   r©  rh   s         €€€€€€rj   Ú
array_funcz/GroupBy._cython_agg_general.<locals>.array_func  s]  ø€ ð !$ ~Ð 5ò !¸&¿,¹,Ì"Ï(É(ØóKñ ;Ðñ !Ø # u¢‘u°%‘à�ðØ8˜Ÿ™×8Ñ8ØØðð Ÿ™ Q™Ø'ñ	ð
 ñ�ñ" %¨¯©×):Ñ):¸cÒ)AØ"%¨¢,™3°C�DÜŸX™XÜŸ™ Ó(¨$´·
±
¸6Ó0Bóç‘fœT“lð ð �øô 'ò ð
 �; #Ð)EÑ"EÜ#Ø˜%Ð5°f·l±l°^À6ÐJóàðô #Fûðúð" �?Ð"�?Ø×*Ñ*¨3°¸T¿Y¹YÈCÐ*ÓPˆFØˆMs   ¹.C Ã	DÃ&"DÄD©ÚidxminÚidxmaxÚskipna)r™  r¹  ri   r  ©r&  r   r‡   r   )	r,   rÏ   Ú_get_data_to_aggregateÚgrouped_reduceÚ_wrap_agged_managerÚ_wrap_idxmax_idxminrN  r%  r‘   )rh   r™  rš  r¡  r©  rr   rµ  Únew_mgrr  ÚoutrQ  s   ``` ``    @rj   Ú_cython_agg_generalzGroupBy._cython_agg_generalú  sª   ý€ ô �|Ô$ÜÐGÓHÐHà×*Ñ*¸È3Ð*ÓOˆ÷&	ò &	ðP ×%Ñ% jÓ1ˆØ×&Ñ& wÓ/ˆØÐ&Ñ&à×*Ñ*¨3°CÀÀxÑ@PÐ*ÓQˆCØ×*Ñ*¨3Ó/ˆØ×Ñ §¡°ÐÓ;Ð;rl   c                ó   — t        | «      ‚rf   rP  )rh   r™  r¡  rr   s       rj   Ú_cython_transformzGroupBy._cython_transform;  s   € Ü! $Ó'Ð'rl   ©Úenginerj  c               ó†  — t        |t        «      s | j                  |||g|¢­i |¤ŽS |t        j                  vrd|› d�}t        |«      ‚|t        j                  v s|t        j                  v r|�
||d<   ||d<    t        | |«      |i |¤ŽS | j                  r | j                  |g|¢­||dœ|¤ŽS t        j                  | dd«      5  t        j                  | d| j                  j                  «      5   | j                  |g|¢­||dœ|¤Žcd d d «       cd d d «       S # 1 sw Y   nxY wd d d «       y # 1 sw Y   y xY w)	Nrþ   z2' is not a valid function name for transform(name)rÅ  rj  rÄ  r˜   Trœ   )r¬   rŠ   Ú_transform_generalrG   Útransform_kernel_allowlistrÏ   Úcythonized_kernelsr	  r€   r˜   Ú_reduction_kernel_transformrå   Útemp_setattrrœ   Úobserved_grouper)rh   rà   rÅ  rj  rq   rr   rÓ   s          rj   Ú
_transformzGroupBy._transform>  sn  € ô ˜$¤Ô$Ø*�4×*Ñ*¨4°¸ÐXÈÒXÐQWÑXÐXàœ×8Ñ8Ñ8Ø�d�VÐMÐNˆCÜ˜S“/Ð!Ø”T×,Ñ,Ñ,°¼×8SÑ8SÑ0SàÐ!Ø#)��xÑ Ø*7��Ñ'Ø&”7˜4 Ó&¨Ð7°Ñ7Ð7ð �}Š}Ø7�t×7Ñ7ØðØñØ(.¸mñØOUñð ô
 × Ñ   z°4Ó8ñä× Ñ   z°4·=±=×3QÑ3QÓRñð 8�t×7Ñ7ØðØñØ(.¸mñØOUñ÷	÷ ÷ ó ú÷ ÷ ñ ús$   Ã
,D7Ã6D"Ä	D7Ä"D+	Ä'D7Ä7E c               ó  — t        j                  | dd«      5  |dv r$t        d|«      } | j                  |dg|¢­i |¤Ž}n|�
||d<   ||d<    t	        | |«      |i |¤Ž}d d d «       | j                  «      S # 1 sw Y   ŒxY w)Nr—   Tr¶  zLiteral['idxmin', 'idxmax']rÅ  rj  )rå   rË  r   Ú_idxmax_idxminr€   Ú_wrap_transform_fast_result)rh   rà   rÅ  rj  rq   rr   rî   s          rj   rÊ  z#GroupBy._reduction_kernel_transform]  s¦   € ô ×Ñ˜d J°Ó5ñ 
	>ð Ð+Ñ+ÜÐ9¸4Ó@�Ø,˜×,Ñ,¨T°4ÐI¸$ÒIÀ&ÑI‘àÐ%Ø'-�F˜8Ñ$Ø.;�F˜?Ñ+Ø,œ  tÓ,¨dÐ=°fÑ=�÷
	>ð ×/Ñ/°Ó7Ð7÷
	>ð 
	>ús   ˜AA8Á8Bc                ó(  — | j                   }| j                  j                  }|j                  | j                  j                  d¬«      }| j
                  j                  dk(  r`t        j                  |j                  || j                  j                  ¬«      }|j                  ||j                  |j                  ¬«      }|S |j                  j                  |«      }|j                  d||fid¬«      }|j!                  |j                  d¬«      }|S )z7
        Fast transform path for aggregations.
        r   r  r©   )Ú
allow_fill©r  r‚   T)Ú
allow_dups)rÚ   rœ   r  r#  r  r‘   r$  r:   Útake_ndr   r  rw  r  r‚   r"  Ú_reindex_with_indexersr3  )rh   rî   r‘   r  rÀ  ÚoutputÚnew_axs          rj   rÐ  z#GroupBy._wrap_transform_fast_results  sé   € ð
 ×'Ñ'ˆð �m‰m×ÑˆØ—‘ §¡× :Ñ :À�ÓCˆà�8‰8�=‰=˜AÒä×$Ñ$Ø—‘ °·±×0LÑ0LôˆCð ×%Ñ% c°·±ÀÇÁÐ%ÓJˆFð ˆð —\‘\×&Ñ& sÓ+ˆFØ×2Ñ2°A¸À°}Ð3EÐRVÐ2ÓWˆFØ—_‘_ S§Y¡Y°Q�_Ó7ˆFØˆrl   c                óR  — t        |«      dk(  rt        j                  g d¬«      }n(t        j                  t        j                  |«      «      }|r| j
                  j                  |d¬«      }|S t        j                  t        | j
                  j                  «      t        ¬«      }|j                  d«       d||j                  t        «      <   t        j                  |g | j
                  j                  dd  ¢d‘«      j                  }| j
                  j!                  |«      }|S )Nr   Úint64r�  r  FTr©   )r®   r¾   Úarrayr“   ÚconcatenaterÛ   r"  Úemptyr  rŸ   r´  r–  rð   rA  r“  r[   r¯  )rh   r´   r•   Úfilteredr+  s        rj   Ú_apply_filterzGroupBy._apply_filter‘  së   € äˆw‹<˜1ÒÜ—h‘h˜r¨Ô1‰Gä—g‘gœbŸn™n¨WÓ5Ó6ˆGÙØ×)Ñ)×.Ñ.¨w¸QÐ.Ó?ˆHð ˆô —8‘8œC × 2Ñ 2× 8Ñ 8Ó9ÄÔFˆDØ�I‰I�eÔØ(,ˆD�—‘¤Ó$Ñ%ä—7‘7˜4Ð!C 4×#5Ñ#5×#;Ñ#;¸A¸BÐ#?Ð!CÀÐ!CÓD×FÑFˆDØ×)Ñ)×/Ñ/°Ó5ˆHØˆrl   c                ó  — | j                   j                  }| j                   j                  }t        ||«      }||   t	        |«      }}|dk(  r%t        j                  dt
        j                  ¬«      S t
        j                  d|dd |dd k7  f   }t        j                  t
        j                  t        j                  |«      d   |f   «      }| j                  «       }|r|t        j                  ||   |«      z  }n2t        j                  |t
        j                  |dd df      |«      |z
  }| j                   j                  rHt        j                  |dk(  t
        j                  |j!                  t
        j"                  d¬«      «      }n!|j!                  t
        j                  d¬«      }t        j                  |t
        j$                  ¬«      }	t        j&                  |t
        j$                  ¬«      |	|<   ||	   S )	a.  
        Parameters
        ----------
        ascending : bool, default True
            If False, number in reverse, from length of group - 1 to 0.

        Notes
        -----
        this is currently implementing sort=False
        (though the default is sort=True) for groupby in general
        r   r�  TNr  r©   Fr1  )rœ   r  r¢   rR   r®   r¾   rÝ  rÚ  Úr_ÚdiffÚnonzeroÚcumsumrE  r  r¯  rÃ   r–  Úfloat64ÚintpÚarange)
rh   Ú	ascendingr  r¢   ÚsorterÚcountÚrunÚreprÀ  Úrevs
             rj   Ú_cumcount_arrayzGroupBy._cumcount_array¢  s�  € ð �m‰m×ÑˆØ—-‘-×'Ñ'ˆÜ'¨¨WÓ5ˆØ˜‘[¤# c£(ˆUˆà�AŠ:Ü—8‘8˜A¤R§X¡XÔ.Ð.ä�e‰e�D˜#˜c˜r˜( c¨!¨" gÑ-Ð-Ñ.ˆÜ�g‰g”b—e‘eœBŸJ™J s›O¨AÑ.°Ð5Ñ6Ó7ˆØˆt�m‰m‹oˆáØ”2—9‘9˜S ™X sÓ+Ñ+‰Cä—)‘)˜C¤§¡ c¨!¨" g¨t mÑ 4Ñ5°sÓ;¸cÑAˆCà�=‰=×'Ò'Ü—(‘(˜3 "™9¤b§f¡f¨c¯j©j¼¿¹È%¨jÓ.PÓQ‰Cà—*‘*œRŸX™X¨E�*Ó2ˆCä�h‰h�u¤B§G¡GÔ,ˆÜ—i‘i ¬R¯W©WÔ5ˆˆF‰Ø�3‰xˆrl   c                óÆ   — t        | j                  t        «      r| j                  j                  S t        | j                  t        «      sJ ‚| j                  j
                  S rf   )r¬   r‘   rE   Ú_constructor_slicedrQ   rw  r£   s    rj   Ú_obj_1d_constructorzGroupBy._obj_1d_constructorË  sF   € ô �d—h‘h¤	Ô*Ø—8‘8×/Ñ/Ð/Ü˜$Ÿ(™(¤FÔ+Ð+Ð+Ø�x‰x×$Ñ$Ð$rl   c                ó2   ‡— | j                  dˆfd„‰¬«      S )aè  
        Return True if any value in the group is truthful, else False.

        This is equivalent to calling ``bool`` on each value in the group and
        returning ``True`` if at least one is truthful.

        Parameters
        ----------
        skipna : bool, default True
            Flag to ignore nan values during truth testing.

        Returns
        -------
        Series or DataFrame
            DataFrame or Series of boolean values, where a value is True if any element
            is True within its respective group, False otherwise.

        See Also
        --------
        Series.any : Apply function any to a Series.
        DataFrame.any : Apply function any to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, 0], index=lst)
        >>> ser
        a    1
        a    2
        b    0
        dtype: int64
        >>> ser.groupby(level=0).any()
        a     True
        b    False
        dtype: bool

        For DataFrameGroupBy:

        >>> data = [[1, 0, 3], [1, 0, 6], [7, 1, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["ostrich", "penguin", "parrot"]
        ... )
        >>> df
                 a  b  c
        ostrich  1  0  3
        penguin  1  0  6
        parrot   7  1  9
        >>> df.groupby(by=["a"]).any()
               b      c
        a
        1  False   True
        7   True   True
        r¤  c                ó>   •— t        | d¬«      j                  ‰¬«      S ©NFr1  ©r¹  )rQ   r¤  ©r  r¹  s    €rj   r¹   zGroupBy.any.<locals>.<lambda>  ó   ø€ œ& ¨Ô/×3Ñ3¸6Ð3ÓB€ rl   ©rš  r¹  ©rÁ  ©rh   r¹  s    `rj   r¤  zGroupBy.anyÔ  s'   ø€ ðr ×'Ñ'ØÛBØð (ó 
ð 	
rl   c                ó2   ‡— | j                  dˆfd„‰¬«      S )aê  
        Return True if all values in the group are truthful, else False.

        This is equivalent to calling ``bool`` on each value in the group and
        returning ``True`` only if all are truthful.

        Parameters
        ----------
        skipna : bool, default True
            Flag to ignore nan values during truth testing.

        Returns
        -------
        Series or DataFrame
            DataFrame or Series of boolean values, where a value is True if all elements
            are True within its respective group, False otherwise.

        See Also
        --------
        Series.all : Apply function all to a Series.
        DataFrame.all : Apply function all to each row or column of a DataFrame.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, 0], index=lst)
        >>> ser
        a    1
        a    2
        b    0
        dtype: int64
        >>> ser.groupby(level=0).all()
        a     True
        b    False
        dtype: bool

        For DataFrameGroupBy:

        >>> data = [[1, 0, 3], [1, 5, 6], [7, 8, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["ostrich", "penguin", "parrot"]
        ... )
        >>> df
                 a  b  c
        ostrich  1  0  3
        penguin  1  5  6
        parrot   7  8  9
        >>> df.groupby(by=["a"]).all()
               b      c
        a
        1  False   True
        7   True   True
        r¥  c                ó>   •— t        | d¬«      j                  ‰¬«      S rô  )rQ   r¥  rö  s    €rj   r¹   zGroupBy.all.<locals>.<lambda>O  r÷  rl   rø  rù  rú  s    `rj   r¥  zGroupBy.all  s'   ø€ ðt ×'Ñ'ØÛBØð (ó 
ð 	
rl   c                ó&  ‡‡‡‡	— | j                  «       }| j                  j                  Š| j                  j                  Š	‰dk7  Š|j                  dk(  Šdˆˆˆˆ	fd„}|j                  |«      }| j                  |«      }| j                  |«      }|S )a~  
        Compute count of group, excluding missing values.

        Returns the number of non-NA/null observations per group.

        Returns
        -------
        Series or DataFrame
            Count of values within each group.

        See Also
        --------
        Series.count : Apply function count to a Series.
        DataFrame.count : Apply function count to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, np.nan], index=lst)
        >>> ser
        a    1.0
        a    2.0
        b    NaN
        dtype: float64
        >>> ser.groupby(level=0).count()
        a    2
        b    0
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, np.nan, 3], [1, np.nan, 6], [7, 8, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["cow", "horse", "bull"]
        ... )
        >>> df
                a	  b	c
        cow     1	NaN	3
        horse	1	NaN	6
        bull	7	8.0	9
        >>> df.groupby("a").count()
            b   c
        a
        1   0   2
        7   1   1

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 2, 3, 4],
        ...     index=pd.DatetimeIndex(
        ...         ["2023-01-01", "2023-01-15", "2023-02-01", "2023-02-15"]
        ...     ),
        ... )
        >>> ser
        2023-01-01    1
        2023-01-15    2
        2023-02-01    3
        2023-02-15    4
        dtype: int64
        >>> ser.resample("MS").count()
        2023-01-01    2
        2023-02-01    2
        Freq: MS, dtype: int64
        r  r©   c                óT  •— | j                   dk(  r ‰t        | «      j                  dd«       z  }n‰t        | «       z  }t        j                  |‰‰¬«      }t        | t        «      r@t        |d   t        j                  |j                  d   t        j                  ¬«      ¬«      S t        | t        «      rDt        | j                  t        «      s*t        d«      }t!        | «      j#                  |d   |¬«      S ‰r*|j                   dk(  sJ ‚|j                  d   dk(  sJ ‚|d   S |S )	Nr©   r  )r*  Úmax_binr   r�  )r+  zint64[pyarrow]rc  )r$  r7   Úreshaper   Úcount_level_2dr¬   r>   r@   r¾   Úzerosr“  Úbool_r=   r‘  rA   r6   rú   r˜  )ÚbvaluesÚmaskedÚcountedr‘  r  Ú	is_seriesr+  r¢   s       €€€€rj   ÚhfunczGroupBy.count.<locals>.hfuncŸ  s  ø€ à�|‰|˜qÒ à¤ g£×!6Ñ!6°q¸"Ó!=Ð =Ñ=‘à¤ g£ Ñ.�ä×(Ñ(¨¸ÀWÔMˆGÜ˜'¤?Ô3Ü#Ø˜A‘J¤R§X¡X¨g¯m©m¸AÑ.>ÄbÇhÁhÔ%Oôð ô ˜GÔ%8Ô9Ä*Ø—‘œ{ôCô %Ð%5Ó6�Ü˜G“}×3Ñ3°G¸A±JÀeÐ3ÓLÐLÙØ—|‘| qÒ(Ð(Ð(Ø—}‘} QÑ'¨1Ò,Ð,Ð,Ø˜q‘zÐ!ØˆNrl   )r  r   r‡   r   )r»  rœ   r  r¢   r$  r¼  r½  rN  )
rh   rQ  r  r¿  Únew_objrî   r  r  r+  r¢   s
         @@@@rj   rê  zGroupBy.countS  s‰   û€ ðJ ×*Ñ*Ó,ˆØ�m‰m×ÑˆØ—-‘-×'Ñ'ˆØ�b‰yˆà—I‘I ‘Nˆ	÷	ð 	ð0 ×%Ñ% eÓ,ˆØ×*Ñ*¨7Ó3ˆØ×-Ñ-¨gÓ6ˆàˆrl   c                ó¢   ‡‡— t        |«      r*ddlm} | j                  |t        j
                  |d‰¬«      S | j                  dˆˆfd„‰‰¬«      S )aì	  
        Compute mean of groups, excluding missing values.

        Returns the arithmetic mean for each group. Missing values are
        ignored unless the entire group is NA, in which case the result
        for that group is NA.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

            .. versionchanged:: 2.0.0

                numeric_only no longer accepts ``None`` and defaults to ``False``.

        skipna : bool, default True
            Exclude NA/null values. If an entire group is NA, the result will be NA.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or globally setting
              ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nogil': False, 'parallel': False}``

        Returns
        -------
        pandas.Series or pandas.DataFrame
            Mean of values within each group. Same object type as the caller.

        See Also
        --------
        Series.mean : Apply function mean to a Series.
        DataFrame.mean : Apply function mean to each row or column of a DataFrame.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {"A": [1, 1, 2, 1, 2], "B": [np.nan, 2, 3, 4, 5], "C": [1, 2, 1, 1, 2]},
        ...     columns=["A", "B", "C"],
        ... )

        Groupby one column and return the mean of the remaining columns in
        each group.

        >>> df.groupby("A").mean()
             B         C
        A
        1  3.0  1.333333
        2  4.0  1.500000

        Groupby two columns and return the mean of the remaining column.

        >>> df.groupby(["A", "B"]).mean()
                 C
        A B
        1 2.0  2.0
          4.0  1.0
        2 3.0  1.0
          5.0  2.0

        Groupby one column and return the mean of only particular column in
        the group.

        >>> df.groupby("A")["B"].mean()
        A
        1    3.0
        2    4.0
        Name: B, dtype: float64
        r   )Úgrouped_mean©Úmin_periodsr¹  Úmeanc                ó@   •— t        | d¬«      j                  ‰‰¬«      S ©NFr1  ©r¡  r¹  )rQ   r  ©r  r¡  r¹  s    €€rj   r¹   zGroupBy.mean.<locals>.<lambda>   s#   ø€ œf Q¨UÔ3×8Ñ8Ø!-°fð 9ó € rl   ©rš  r¡  r¹  )rT   Úpandas.core._numba.kernelsr  ro  r<   Úfloat_dtype_mappingrÁ  )rh   r¡  r¹  rÅ  rj  r  s    ``   rj   r  zGroupBy.mean½  sh   ù€ ôl ˜6Ô"Ý?à×*Ñ*ØÜ×,Ñ,ØØØð +ó ð ð ×+Ñ+Øôð *Øð ,ó ð rl   c                ó8   ‡‡— | j                  dˆˆfd„‰‰¬«      S )a.	  
        Compute median of groups, excluding missing values.

        For multiple groupings, the result index will be a MultiIndex

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

            .. versionchanged:: 2.0.0

                numeric_only no longer accepts ``None`` and defaults to False.

        skipna : bool, default True
            Exclude NA/null values. If an entire group is NA, the result will be NA.

            .. versionadded:: 3.0.0

        Returns
        -------
        Series or DataFrame
            Median of values within each group.

        See Also
        --------
        Series.median : Apply function median to a Series.
        DataFrame.median : Apply function median to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "a", "b", "b", "b"]
        >>> ser = pd.Series([7, 2, 8, 4, 3, 3], index=lst)
        >>> ser
        a     7
        a     2
        a     8
        b     4
        b     3
        b     3
        dtype: int64
        >>> ser.groupby(level=0).median()
        a    7.0
        b    3.0
        dtype: float64

        For DataFrameGroupBy:

        >>> data = {"a": [1, 3, 5, 7, 7, 8, 3], "b": [1, 4, 8, 4, 4, 2, 1]}
        >>> df = pd.DataFrame(
        ...     data, index=["dog", "dog", "dog", "mouse", "mouse", "mouse", "mouse"]
        ... )
        >>> df
                 a  b
          dog    1  1
          dog    3  4
          dog    5  8
        mouse    7  4
        mouse    7  4
        mouse    8  2
        mouse    3  1
        >>> df.groupby(level=0).median()
                 a    b
        dog    3.0  4.0
        mouse  7.0  3.0

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 2, 3, 3, 4, 5],
        ...     index=pd.DatetimeIndex(
        ...         [
        ...             "2023-01-01",
        ...             "2023-01-10",
        ...             "2023-01-15",
        ...             "2023-02-01",
        ...             "2023-02-10",
        ...             "2023-02-15",
        ...         ]
        ...     ),
        ... )
        >>> ser.resample("MS").median()
        2023-01-01    2.0
        2023-02-01    4.0
        Freq: MS, dtype: float64
        Úmedianc                ó@   •— t        | d¬«      j                  ‰‰¬«      S r  )rQ   r  r  s    €€rj   r¹   z GroupBy.median.<locals>.<lambda>ƒ  s#   ø€ œ& ¨Ô/×6Ñ6Ø)°&ð 7ó € rl   r  rù  )rh   r¡  r¹  s    ``rj   r  zGroupBy.median'  s.   ù€ ðt ×'Ñ'Øôð &Øð (ó 
ð 	
rl   r©   c           
     óÌ   ‡‡— t        |«      r>ddlm} t        j                  | j                  |t        j                  |d‰‰¬«      «      S | j                  dˆˆfd„|‰‰¬«      S )aF  
        Compute standard deviation of groups, excluding missing values.

        For multiple groupings, the result index will be a MultiIndex.

        Parameters
        ----------
        ddof : int, default 1
            Delta Degrees of Freedom. The divisor used in calculations is ``N - ddof``,
            where ``N`` represents the number of elements.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or globally setting
              ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nogil': False, 'parallel': False}``

        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.

            .. versionchanged:: 2.0.0

                numeric_only now defaults to ``False``.

        skipna : bool, default True
            Exclude NA/null values. If an entire group is NA, the result will be NA.

            .. versionadded:: 3.0.0

        Returns
        -------
        Series or DataFrame
            Standard deviation of values within each group.

        See Also
        --------
        Series.std : Apply function std to a Series.
        DataFrame.std : Apply function std to each row or column of a DataFrame.

        Notes
        -----
        To have the same behaviour as ``numpy.std``, use ``ddof=0`` (instead of
        the default ``ddof=1``) and ``skipna=False``.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "a", "b", "b", "b"]
        >>> ser = pd.Series([7, 2, 8, 4, 3, 3], index=lst)
        >>> ser
        a     7
        a     2
        a     8
        b     4
        b     3
        b     3
        dtype: int64
        >>> ser.groupby(level=0).std()
        a    3.21455
        b    0.57735
        dtype: float64

        For DataFrameGroupBy:

        >>> data = {"a": [1, 3, 5, 7, 7, 8, 3], "b": [1, 4, 8, 4, 4, 2, 1]}
        >>> df = pd.DataFrame(
        ...     data, index=["dog", "dog", "dog", "mouse", "mouse", "mouse", "mouse"]
        ... )
        >>> df
                 a  b
          dog    1  1
          dog    3  4
          dog    5  8
        mouse    7  4
        mouse    7  4
        mouse    8  2
        mouse    3  1
        >>> df.groupby(level=0).std()
                      a         b
        dog    2.000000  3.511885
        mouse  2.217356  1.500000
        r   ©Úgrouped_var©r  Úddofr¹  r«  c                ó@   •— t        | d¬«      j                  ‰‰¬«      S ©NFr1  )r  r¹  )rQ   r«  ©r  r  r¹  s    €€rj   r¹   zGroupBy.std.<locals>.<lambda>ý  ó   ø€ œf Q¨UÔ3×7Ñ7¸TÈ&Ð7ÓQ€ rl   ©rš  r¡  r  r¹  )	rT   r  r  r¾   Úsqrtro  r<   r  rÁ  ©rh   r  rÅ  rj  r¡  r¹  r  s    `   ` rj   r«  zGroupBy.stdŠ  sv   ù€ ôF ˜6Ô"Ý>ä—7‘7Ø×'Ñ'ØÜ×0Ñ0Ø!Ø !ØØ!ð (ó ó	ð 	ð ×+Ñ+ØÜQØ)ØØð ,ó ð rl   c                ó¦   ‡‡— t        |«      r+ddlm} | j                  |t        j
                  |d‰‰¬«      S | j                  dˆˆfd„|‰‰¬«      S )a#
  
        Compute variance of groups, excluding missing values.

        For multiple groupings, the result index will be a MultiIndex.

        Parameters
        ----------
        ddof : int, default 1
            Degrees of freedom.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or globally setting
              ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nogil': False, 'parallel': False}``

        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.

            .. versionchanged:: 2.0.0

                numeric_only now defaults to ``False``.

        skipna : bool, default True
            Exclude NA/null values. If an entire group is NA, the result will be NA.

            .. versionadded:: 3.0.0

        Returns
        -------
        Series or DataFrame
            Variance of values within each group.

        See Also
        --------
        Series.var : Apply function var to a Series.
        DataFrame.var : Apply function var to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "a", "b", "b", "b"]
        >>> ser = pd.Series([7, 2, 8, 4, 3, 3], index=lst)
        >>> ser
        a     7
        a     2
        a     8
        b     4
        b     3
        b     3
        dtype: int64
        >>> ser.groupby(level=0).var()
        a    10.333333
        b     0.333333
        dtype: float64

        For DataFrameGroupBy:

        >>> data = {"a": [1, 3, 5, 7, 7, 8, 3], "b": [1, 4, 8, 4, 4, 2, 1]}
        >>> df = pd.DataFrame(
        ...     data, index=["dog", "dog", "dog", "mouse", "mouse", "mouse", "mouse"]
        ... )
        >>> df
                 a  b
          dog    1  1
          dog    3  4
          dog    5  8
        mouse    7  4
        mouse    7  4
        mouse    8  2
        mouse    3  1
        >>> df.groupby(level=0).var()
                      a          b
        dog    4.000000  12.333333
        mouse  4.916667   2.250000
        r   r  r  Úvarc                ó@   •— t        | d¬«      j                  ‰‰¬«      S r  )rQ   r&  r   s    €€rj   r¹   zGroupBy.var.<locals>.<lambda>n	  r!  rl   r"  )rT   r  r  ro  r<   r  rÁ  r$  s    `   ` rj   r&  zGroupBy.var	  sj   ù€ ôz ˜6Ô"Ý>à×*Ñ*ØÜ×,Ñ,ØØØØð +ó ð ð ×+Ñ+ØÜQØ)ØØð ,ó ð rl   c                ó  ‡‡‡ — |rdnd}| j                   }| j                  Š| j                  j                  D �ch c]  }|j                  sŒ|j
                  ’Œ c}Št        ‰t        «      r‰j
                  }	|	‰v rg n‰g}
nyt        ‰j                  «      }|�@t        |«      Š ‰ t        ‰«      z  }|rt        d|› d�«      ‚‰ |z
  }|rt        d|› d�«      ‚|Š ˆˆˆ fd„t        ‰j                  «      D «       }
t        | j                  j                  «      }|
D ].  }t        ||dd|¬«      \  }}}|t        |j                  «      z  }Œ0 |j                  |d| j                  | j                   ¬	«      }t#        d
|j%                  «       «      }||_        |r|j'                  |d¬«      }| j(                  r…|j*                  j,                  }t/        t1        |«      «      |j*                  _        t/        t1        | j                  j                  «      «      }|j3                  |d¬«      }||j*                  _        |r­t        t/        t1        | j                  j                  «      |j*                  j4                  «      «      }|j                  |j*                  j7                  |«      | j(                  | j                   d¬«      j9                  d«      }||z  }|j;                  d«      }| j<                  r|}nã|j*                  }t?        j@                  |j,                  «      }||v rt        d|› d�«      ‚||_        |jC                  t/        t1        |«      «      «      |_        |jE                  «       }| j                  j                  d   j                   j                  jF                  }tI        ||¬«      jK                  t1        |«      |«      }||_	        |}|jM                  | j                   d¬«      S c c}w )zø
        Shared implementation of value_counts for SeriesGroupBy and DataFrameGroupBy.

        SeriesGroupBy additionally supports a bins argument. See the docstring of
        DataFrameGroupBy.value_counts for a description of arguments.
        Ú
proportionrê  zKeys z0 in subset cannot be in the groupby column keys.z) in subset do not exist in the DataFrame.c              3  óZ   •K  — | ]"  \  }}|‰vr|‰v r‰j                   d d …|f   –— Œ$ y ­wrf   )rç   )rÄ   ÚidxÚ_nameÚin_axis_namesr‘   Ú	subsetteds      €€€rj   rÆ   z(GroupBy._value_counts.<locals>.<genexpr> 	  s;   øè ø€ ò ñ �C˜Ø Ñ-°%¸9Ñ2Dð —‘š˜C˜Õ ñùs   ƒ(+F)rp   r“   r˜   r•   )r“   r˜   r•   rQ   Ústable)rè  r®  )r”   Úsort_remaining)r“   r•   r˜   Úsumrª  zColumn label 'z' is duplicate of result columnr   r�  Úvalue_countsr  )'r‘   rÚ   rœ   r?  Úin_axisr‚   r¬   rQ   Úsetr:  rÏ   rB  r­   rJ   ri   r˜   r•   r   ÚsizeÚsort_valuesr“   r  r  Úranger®   r5  r;  Ú	droplevelÚ	transformÚfillnar—   rå   Úfill_missing_namesÚ	set_namesÚreset_indexr‘  rM   r@  r%  )!rh   ÚsubsetÚ	normalizer“   rè  r•   r‚   rl  Úgroupingr,  r’   Úunique_colsÚclashingÚdoesnt_existr?  rp   r–   r.  ÚgbÚresult_seriesr  Úindex_levelr  Úindexed_group_sizerî   r  r:  Úresult_frameÚ
orig_dtypeÚcolsr-  r‘   r.  s!                                 @@@rj   Ú_value_countszGroupBy._value_countst	  sÅ  ú€ ñ  )‰|¨gˆà�X‰XˆØ×'Ñ'ˆð +/¯-©-×*AÑ*Aö
Ø&ÀX×EUÓEUˆH�M‹Mò
ˆô �cœ6Ô"Ø—H‘HˆEØ+0°MÑ+A¡RÈÀu‰Dä˜cŸk™kÓ*ˆKØÐ!Ü ›K�	Ø$¤s¨=Ó'9Ñ9�ÙÜ$Ø ˜zð *3ð 3óð ð  )¨;Ñ6�ÙÜ$Ø ˜~Ð-VÐWóð ð (�	õô #,¨C¯K©KÓ"8ôˆDô ˜Ÿ™×0Ñ0Ó1ˆ	Øò 	1ˆCÜ'ØØØØØô‰MˆG�Q˜ð œ˜g×/Ñ/Ó0Ñ0‰Ið	1ð �Z‰ZØØØ—]‘]Ø—;‘;ð	 ó 
ˆô ˜X r§w¡w£yÓ1ˆØ!ˆÔáà)×5Ñ5Ø#¨(ð 6ó ˆMð �9Š9à!×'Ñ'×-Ñ-ˆEä(-¬c°%«jÓ(9ˆM×ÑÔ%Ü¤ D§M¡M×$;Ñ$;Ó <Ó=ˆKØ)×4Ñ4Ø!°%ð 5ó ˆMð ).ˆM×ÑÔ%áô Ü”c˜$Ÿ-™-×1Ñ1Ó2°M×4GÑ4G×4OÑ4OÓPóˆFð "/×!6Ñ!6Ø×#Ñ#×-Ñ-¨fÓ5Ø—Y‘YØ—{‘{àð "7ó "÷ ‰i˜Óð ð Ð/Ñ/ˆMð *×0Ñ0°Ó5ˆMð �=Š=Ø"‰Fð "×'Ñ'ˆEÜ×,Ñ,¨U¯[©[Ó9ˆGØ�w‰Ü  >°$°Ð7VÐ!WÓXÐXØ!%ˆMÔØ"'§/¡/´%¼¸G»Ó2EÓ"FˆMÔØ(×4Ñ4Ó6ˆLØŸ™×0Ñ0°Ñ3×7Ñ7×?Ñ?×EÑEˆJÜ˜¨
Ô3×:Ñ:¼3¸w»<ÈÓNˆDØ#'ˆLÔ Ø!ˆFØ×"Ñ" 4§8¡8°NÐ"ÓCÐCùòO
s   ºO<ÁO<c                ó"  ‡‡— |rr| j                   j                  dk(  rYt        | j                   j                  «      s:t	        t        | «      j                  › d|› d| j                   j                  › �«      ‚| j                  dˆˆfd„|‰‰¬«      S )ar	  
        Compute standard error of the mean of groups, excluding missing values.

        For multiple groupings, the result index will be a MultiIndex.

        Parameters
        ----------
        ddof : int, default 1
            Degrees of freedom.

        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.

            .. versionchanged:: 2.0.0

                numeric_only now defaults to ``False``.

        skipna : bool, default True
            Exclude NA/null values. If an entire group is NA, the result will be NA.

            .. versionadded:: 3.0.0

        Returns
        -------
        Series or DataFrame
            Standard error of the mean of values within each group.

        See Also
        --------
        DataFrame.sem : Return unbiased standard error of the mean over requested axis.
        Series.sem : Return unbiased standard error of the mean over requested axis.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([5, 10, 8, 14], index=lst)
        >>> ser
        a     5
        a    10
        b     8
        b    14
        dtype: int64
        >>> ser.groupby(level=0).sem()
        a    2.5
        b    3.0
        dtype: float64

        For DataFrameGroupBy:

        >>> data = [[1, 12, 11], [1, 15, 2], [2, 5, 8], [2, 6, 12]]
        >>> df = pd.DataFrame(
        ...     data,
        ...     columns=["a", "b", "c"],
        ...     index=["tuna", "salmon", "catfish", "goldfish"],
        ... )
        >>> df
                   a   b   c
            tuna   1  12  11
          salmon   1  15   2
         catfish   2   5   8
        goldfish   2   6  12
        >>> df.groupby("a").sem()
              b  c
        a
        1    1.5  4.5
        2    0.5  2.0

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 3, 2, 4, 3, 8],
        ...     index=pd.DatetimeIndex(
        ...         [
        ...             "2023-01-01",
        ...             "2023-01-10",
        ...             "2023-01-15",
        ...             "2023-02-01",
        ...             "2023-02-10",
        ...             "2023-02-15",
        ...         ]
        ...     ),
        ... )
        >>> ser.resample("MS").sem()
        2023-01-01    0.577350
        2023-02-01    1.527525
        Freq: MS, dtype: float64
        r©   z.sem called with numeric_only=z and dtype r¬  c                ó@   •— t        | d¬«      j                  ‰‰¬«      S r  )rQ   r¬  r   s    €€rj   r¹   zGroupBy.sem.<locals>.<lambda>U
  s   ø€ œ& ¨Ô/×3Ñ3¸ÀfÐ3ÓM€ rl   r"  )r‘   r$  r2   r‘  rˆ  rú   rt   rÁ  )rh   r  r¡  r¹  s    ` `rj   r¬  zGroupBy.semñ	  s�   ù€ ñz ˜DŸH™HŸM™M¨QÒ.Ô7GÈÏÉÏÉÔ7WÜÜ˜“:×&Ñ&Ð'ð ( Ø ,˜~¨[¸¿¹¿¹Ð8HðJóð ð ×'Ñ'ØÜMØ%ØØð (ó 
ð 	
rl   c                óø  — | j                   j                  «       }d}t        | j                  t        «      r±t        | j                  j
                  t        «      rgt        | j                  j
                  t        «      r@| j                  j
                  j                  j                  t        j                  u rd}n,d}n)d}n&t        | j                  j
                  t        «      rd}t        | j                  t        «      r(| j                  || j                  j                  ¬«      }n| j                  |«      }|�|j                  |¬«      }| j                   s|j#                  d«      j%                  «       }|S )ai  
        Compute group sizes.

        Returns the number of rows in each group. This is useful for
        understanding the distribution of data across groups.

        Returns
        -------
        DataFrame or Series
            Number of rows in each group as a Series if as_index is True
            or a DataFrame if as_index is False.

        See Also
        --------
        Series.size : Apply function size to a Series.
        DataFrame.size : Apply function size to each row or column of a DataFrame.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([1, 2, 3], index=lst)
        >>> ser
        a     1
        a     2
        b     3
        dtype: int64
        >>> ser.groupby(level=0).size()
        a    2
        b    1
        dtype: int64

        >>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["owl", "toucan", "eagle"]
        ... )
        >>> df
                a  b  c
        owl     1  2  3
        toucan  1  5  6
        eagle   7  8  9
        >>> df.groupby("a").size()
        a
        1    2
        7    1
        dtype: int64

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 2, 3],
        ...     index=pd.DatetimeIndex(["2023-01-01", "2023-01-15", "2023-02-01"]),
        ... )
        >>> ser
        2023-01-01    1
        2023-01-15    2
        2023-02-01    3
        dtype: int64
        >>> ser.resample("MS").size()
        2023-01-01    2
        2023-02-01    1
        Freq: MS, dtype: int64
        NÚnumpy_nullableÚpyarrow)r‚   )Údtype_backendr5  )rœ   r5  r¬   r‘   rQ   rÛ  r=   rB   r‘  Úna_valuer¾   rÃ   r>   rñ  r‚   Úconvert_dtypesr—   Úrenamer=  )rh   rî   rQ  s      rj   r5  zGroupBy.size[
  s  € ðF —‘×#Ñ#Ó%ˆØEIˆÜ�d—h‘h¤Ô'Ü˜$Ÿ(™(Ÿ.™.Ô*=Ô>Ü˜dŸh™hŸn™nÔ.>Ô?Ø—x‘x—~‘~×+Ñ+×4Ñ4¼¿¹Ñ>Ø(,™à(8™à$-‘MÜ˜DŸH™HŸN™N¬OÔ<Ø 0�ô �d—h‘h¤Ô'Ø×-Ñ-¨f¸4¿8¹8¿=¹=Ð-ÓI‰Fà×-Ñ-¨fÓ5ˆFàÐ$Ø×*Ñ*¸Ð*ÓGˆFà�}Š}Ø—]‘] 6Ó*×6Ñ6Ó8ˆFØˆrl   c                ó¦   ‡— t        |«      r*ddlm} | j                  |t        j
                  ||‰¬«      S dˆfd„}| j                  d|||‰¬«      S )a4  
        Compute sum of group values.

        Computes the sum for each group. Null values are excluded by
        default unless ``skipna`` is set to ``False``.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

            .. versionchanged:: 2.0.0

                numeric_only no longer accepts ``None``.

        min_count : int, default 0
            The required number of valid values to perform the operation. If fewer
            than ``min_count`` non-NA values are present the result will be NA.

        skipna : bool, default True
            Exclude NA/null values. If the entire group is NA and ``skipna`` is
            ``True``, the result will be NA.

            .. versionchanged:: 3.0.0

        engine : str, default None None
            * ``'cython'`` : Runs rolling apply through C-extensions from cython.
            * ``'numba'`` : Runs rolling apply through JIT compiled code from numba.
                Only available when ``raw`` is set to ``True``.
            * ``None`` : Defaults to ``'cython'`` or globally setting
                ``compute.use_numba``

        engine_kwargs : dict, default None None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
                and ``parallel`` dictionary keys. The values must either be ``True`` or
                ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
                ``{'nogil': False, 'parallel': False}`` and will be
                applied to both the ``func`` and the ``apply`` groupby aggregation.

        Returns
        -------
        Series or DataFrame
            Computed sum of values within each group.

        See Also
        --------
        Series.sum : Return the sum of the values over the requested axis.
        DataFrame.sum : Return the sum of the values over the requested axis.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([1, 2, 3, 4], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        b    4
        dtype: int64
        >>> ser.groupby(level=0).sum()
        a    3
        b    7
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 8, 2], [1, 2, 5], [2, 5, 8], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data,
        ...     columns=["a", "b", "c"],
        ...     index=["tiger", "leopard", "cheetah", "lion"],
        ... )
        >>> df
                  a  b  c
          tiger   1  8  2
        leopard   1  2  5
        cheetah   2  5  8
           lion   2  6  9
        >>> df.groupby("a").sum()
             b   c
        a
        1   10   7
        2   11  17
        r   )Úgrouped_sumr  c                ó(   •— | j                  ‰¬«      S ©Nrõ  )r1  ©r‘   r¹  s    €rj   Ú
sum_compatzGroupBy.sum.<locals>.sum_compat&  ó   ø€ à—w‘w f�wÓ-Ð-rl   r1  ©rš  r¡  r©  r¹  ©r‘   r   )rT   r  rV  ro  r<   Údefault_dtype_mappingrÁ  )rh   r¡  r©  r¹  rÅ  rj  rV  rZ  s      `    rj   r1  zGroupBy.sumº
  sl   ø€ ô@ ˜6Ô"Ý>à×*Ñ*ØÜ×.Ñ.ØØ%Øð +ó ð õ.ð ×+Ñ+ØØØ)Ø#Øð ,ó ð rl   c                ó<   ‡— dˆfd„}| j                  d|||‰¬«      S )aŠ  
        Compute prod of group values.

        This method computes the product of all values within each group,
        returning a result for each group.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

            .. versionchanged:: 2.0.0

                numeric_only no longer accepts ``None``.

        min_count : int, default 0
            The required number of valid values to perform the operation. If fewer
            than ``min_count`` non-NA values are present the result will be NA.

        skipna : bool, default True
            Exclude NA/null values. If an entire group is NA, the result will be NA.

            .. versionadded:: 3.0.0

        Returns
        -------
        Series or DataFrame
            Computed prod of values within each group.

        See Also
        --------
        Series.prod : Return the product of the values over the requested axis.
        DataFrame.prod : Return the product of the values over the requested axis.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([1, 2, 3, 4], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        b    4
        dtype: int64
        >>> ser.groupby(level=0).prod()
        a    2
        b   12
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 8, 2], [1, 2, 5], [2, 5, 8], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data,
        ...     columns=["a", "b", "c"],
        ...     index=["tiger", "leopard", "cheetah", "lion"],
        ... )
        >>> df
                  a  b  c
          tiger   1  8  2
        leopard   1  2  5
        cheetah   2  5  8
           lion   2  6  9
        >>> df.groupby("a").prod()
             b    c
        a
        1   16   10
        2   30   72
        c                ó(   •— | j                  ‰¬«      S rX  )ÚprodrY  s    €rj   Úprod_compatz!GroupBy.prod.<locals>.prod_compat~  s   ø€ à—8‘8 6�8Ó*Ð*rl   ra  r\  r]  rù  )rh   r¡  r©  r¹  rb  s      ` rj   ra  zGroupBy.prod2  s2   ø€ õX	+ð ×'Ñ'ØØØ%ØØð (ó 
ð 	
rl   c                ó¨   ‡— t        |«      r+ddlm} | j                  |t        j
                  ||d‰¬«      S dˆfd„}| j                  d|||‰¬«      S )	ag  
        Compute min of group values.

        Returns the minimum value for each group. Missing values are
        excluded by default but this behavior can be controlled with
        the ``skipna`` parameter.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

            .. versionchanged:: 2.0.0

                numeric_only no longer accepts ``None``.

        min_count : int, default -1
            The required number of valid values to perform the operation. If fewer
            than ``min_count`` non-NA values are present the result will be NA.

        skipna : bool, default True
            Exclude NA/null values. If the entire group is NA and ``skipna`` is
            ``True``, the result will be NA.

            .. versionchanged:: 3.0.0

        engine : str, default None None
            * ``'cython'`` : Runs rolling apply through C-extensions from cython.
            * ``'numba'`` : Runs rolling apply through JIT compiled code from numba.
                Only available when ``raw`` is set to ``True``.
            * ``None`` : Defaults to ``'cython'`` or globally setting
                ``compute.use_numba``

        engine_kwargs : dict, default None None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
                and ``parallel`` dictionary keys. The values must either be ``True`` or
                ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
                ``{'nogil': False, 'parallel': False}`` and will be
                applied to both the ``func`` and the ``apply`` groupby aggregation.

        Returns
        -------
        Series or DataFrame
            Computed min of values within each group.

        See Also
        --------
        Series.min : Return the minimum of the values over the requested axis.
        DataFrame.min : Return the minimum of the values over the requested axis.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([1, 2, 3, 4], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        b    4
        dtype: int64
        >>> ser.groupby(level=0).min()
        a    1
        b    3
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 8, 2], [1, 2, 5], [2, 5, 8], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data,
        ...     columns=["a", "b", "c"],
        ...     index=["tiger", "leopard", "cheetah", "lion"],
        ... )
        >>> df
                  a  b  c
          tiger   1  8  2
        leopard   1  2  5
        cheetah   2  5  8
           lion   2  6  9
        >>> df.groupby("a").min()
            b  c
        a
        1   2  2
        2   5  8
        r   ©Úgrouped_min_maxF©r  Úis_maxr¹  c                ó(   •— | j                  ‰¬«      S rX  )r§  rY  s    €rj   Ú
min_compatzGroupBy.min.<locals>.min_compatø  s   ø€ ð —w‘w f�wÓ-Ð-rl   r§  r\  r]  ©rT   r  re  ro  r<   Úidentity_dtype_mappingrÁ  )rh   r¡  r©  r¹  rÅ  rj  re  ri  s      `    rj   r§  zGroupBy.minŠ  so   ø€ ôB ˜6Ô"ÝBà×*Ñ*ØÜ×/Ñ/ØØ%ØØð +ó ð õ.ð ×+Ñ+ØØØ)Ø#Øð ,ó ð rl   c                ó¨   ‡— t        |«      r+ddlm} | j                  |t        j
                  ||d‰¬«      S dˆfd„}| j                  d|||‰¬«      S )	ag  
        Compute max of group values.

        Returns the maximum value for each group. Missing values are
        excluded by default but this behavior can be controlled with
        the ``skipna`` parameter.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

            .. versionchanged:: 2.0.0

                numeric_only no longer accepts ``None``.

        min_count : int, default -1
            The required number of valid values to perform the operation. If fewer
            than ``min_count`` non-NA values are present the result will be NA.

        skipna : bool, default True
            Exclude NA/null values. If the entire group is NA and ``skipna`` is
            ``True``, the result will be NA.

            .. versionchanged:: 3.0.0

        engine : str, default None None
            * ``'cython'`` : Runs rolling apply through C-extensions from cython.
            * ``'numba'`` : Runs rolling apply through JIT compiled code from numba.
                Only available when ``raw`` is set to ``True``.
            * ``None`` : Defaults to ``'cython'`` or globally setting
                ``compute.use_numba``

        engine_kwargs : dict, default None None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
                and ``parallel`` dictionary keys. The values must either be ``True`` or
                ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
                ``{'nogil': False, 'parallel': False}`` and will be
                applied to both the ``func`` and the ``apply`` groupby aggregation.

        Returns
        -------
        Series or DataFrame
            Computed max of values within each group.

        See Also
        --------
        Series.max : Return the maximum of the values over the requested axis.
        DataFrame.max : Return the maximum of the values over the requested axis.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([1, 2, 3, 4], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        b    4
        dtype: int64
        >>> ser.groupby(level=0).max()
        a    2
        b    4
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 8, 2], [1, 2, 5], [2, 5, 8], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data,
        ...     columns=["a", "b", "c"],
        ...     index=["tiger", "leopard", "cheetah", "lion"],
        ... )
        >>> df
                  a  b  c
          tiger   1  8  2
        leopard   1  2  5
        cheetah   2  5  8
           lion   2  6  9
        >>> df.groupby("a").max()
            b  c
        a
        1   8  5
        2   6  9
        r   rd  Trf  c                ó(   •— | j                  ‰¬«      S rX  )r¦  rY  s    €rj   Ú
max_compatzGroupBy.max.<locals>.max_compatt  r[  rl   r¦  r\  r]  rj  )rh   r¡  r©  r¹  rÅ  rj  re  rn  s      `    rj   r¦  zGroupBy.max  so   ø€ ôB ˜6Ô"ÝBà×*Ñ*ØÜ×/Ñ/ØØ%ØØð +ó ð õ.ð ×+Ñ+ØØØ)Ø#Øð ,ó ð rl   c                ó6   — dd„}| j                  d||||¬«      S )u€  
        Compute the first entry of each column within each group.

        NA values are skipped by default, so the result is the first non-NA
        value per column â€” which may differ from the first row of the group.
        Pass ``skipna=False`` to keep NAs.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.
        min_count : int, default -1
            The required number of valid values to perform the operation. If fewer
            than ``min_count`` valid values are present the result will be NA.
        skipna : bool, default True
            Exclude NA values. If an entire group is NA, the result will be NA.

            .. versionadded:: 2.2.1

        Returns
        -------
        Series or DataFrame
            First values within each group.

        See Also
        --------
        DataFrame.groupby : Apply a function groupby to each row or column of a
            DataFrame.
        api.typing.DataFrameGroupBy.last : Compute the last entry of each
            column within each group.
        api.typing.DataFrameGroupBy.nth : Take the nth row from each group.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     dict(
        ...         A=[1, 1, 3],
        ...         B=[None, 5, 6],
        ...         C=[1, 2, 3],
        ...         D=["3/11/2000", "3/12/2000", "3/13/2000"],
        ...     )
        ... )
        >>> df["D"] = pd.to_datetime(df["D"])
        >>> df.groupby("A").first()
             B  C          D
        A
        1  5.0  1 2000-03-11
        3  6.0  3 2000-03-13
        >>> df.groupby("A").first(min_count=2)
            B    C          D
        A
        1 NaN  1.0 2000-03-11
        3 NaN  NaN        NaT
        >>> df.groupby("A").first(numeric_only=True)
             B  C
        A
        1  5.0  1
        3  6.0  3
        c                ó¤   — dd„}t        | t        «      r| j                  |«      S t        | t        «      r || «      S t	        t        | «      «      ‚)Nc                ó¦   — | j                   t        | j                   «         }t        |«      s | j                   j                  j                  S |d   S )z-Helper function for first item that isn't NA.r   ©rÛ  r9   r®   r‘  rR  ©r  Úarrs     rj   Úfirstz2GroupBy.first.<locals>.first_compat.<locals>.firstÁ  s<   € à—g‘gœe A§G¡G›nÑ-�Ü˜3”xØŸ7™7Ÿ=™=×1Ñ1Ð1Ø˜1‘v�rl   ©r  rQ   ©r¬   rE   rf  rQ   rˆ  rú   )r‘   ru  s     rj   Úfirst_compatz#GroupBy.first.<locals>.first_compatÀ  sE   € óô ˜#œyÔ)Ø—y‘y Ó'Ð'Ü˜C¤Ô(Ù˜S“zÐ!ä¤ S£	Ó*Ð*rl   ru  r\  r]  rù  )rh   r¡  r©  r¹  rx  s        rj   ru  zGroupBy.first€  s1   € ó@	+ð ×'Ñ'ØØØ%ØØð (ó 
ð 	
rl   c                ó6   — dd„}| j                  d||||¬«      S )uË  
        Compute the last entry of each column within each group.

        NA values are skipped by default, so the result is the last non-NA
        value per column â€” which may differ from the last row of the group.
        Pass ``skipna=False`` to keep NAs.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns. If None, will attempt to use
            everything, then use only numeric data.
        min_count : int, default -1
            The required number of valid values to perform the operation. If fewer
            than ``min_count`` valid values are present the result will be NA.
        skipna : bool, default True
            Exclude NA values. If an entire group is NA, the result will be NA.

            .. versionadded:: 2.2.1

        Returns
        -------
        Series or DataFrame
            Last values within each group.

        See Also
        --------
        DataFrame.groupby : Apply a function groupby to each row or column of a
            DataFrame.
        api.typing.DataFrameGroupBy.first : Compute the first entry of each
            column within each group.
        api.typing.DataFrameGroupBy.nth : Take the nth row from each group.

        Examples
        --------
        >>> df = pd.DataFrame(dict(A=[1, 1, 3], B=[5, None, 6], C=[1, 2, 3]))
        >>> df.groupby("A").last()
             B  C
        A
        1  5.0  2
        3  6.0  3
        c                ó¤   — dd„}t        | t        «      r| j                  |«      S t        | t        «      r || «      S t	        t        | «      «      ‚)Nc                ó¦   — | j                   t        | j                   «         }t        |«      s | j                   j                  j                  S |d   S )z,Helper function for last item that isn't NA.r  rr  rs  s     rj   Úlastz/GroupBy.last.<locals>.last_compat.<locals>.last  s<   € à—g‘gœe A§G¡G›nÑ-�Ü˜3”xØŸ7™7Ÿ=™=×1Ñ1Ð1Ø˜2‘w�rl   rv  rw  )r‘   r|  s     rj   Úlast_compatz!GroupBy.last.<locals>.last_compat  sD   € óô ˜#œyÔ)Ø—y‘y “Ð&Ü˜C¤Ô(Ù˜C“yÐ ä¤ S£	Ó*Ð*rl   r|  r\  r]  rù  )rh   r¡  r©  r¹  r}  s        rj   r|  zGroupBy.last×  s1   € ó^	+ð ×'Ñ'ØØØ%ØØð (ó 
ð 	
rl   c                ó²  — | j                   j                  dk(  r«| j                  }t        |j                  «      }|st        d«      ‚| j                  j                  |j                  ddd¬«      }g d¢}| j                   j                  || j                  j                  |¬«      }| j                  s|j                  «       }|S | j                  d	„ «      }|S )
aX
  
        Compute open, high, low and close values of a group, excluding missing values.

        For multiple groupings, the result index will be a MultiIndex

        Returns
        -------
        DataFrame
            Open, high, low and close values within each group.

        See Also
        --------
        DataFrame.agg : Aggregate using one or more operations over the specified axis.
        DataFrame.resample : Resample time-series data.
        DataFrame.groupby : Group DataFrame using a mapper or by a Series of columns.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = [
        ...     "SPX",
        ...     "CAC",
        ...     "SPX",
        ...     "CAC",
        ...     "SPX",
        ...     "CAC",
        ...     "SPX",
        ...     "CAC",
        ... ]
        >>> ser = pd.Series([3.4, 9.0, 7.2, 5.2, 8.8, 9.4, 0.1, 0.5], index=lst)
        >>> ser
        SPX     3.4
        CAC     9.0
        SPX     7.2
        CAC     5.2
        SPX     8.8
        CAC     9.4
        SPX     0.1
        CAC     0.5
        dtype: float64
        >>> ser.groupby(level=0).ohlc()
             open  high  low  close
        CAC   9.0   9.4  0.5    0.5
        SPX   3.4   8.8  0.1    0.1

        For DataFrameGroupBy:

        >>> data = {
        ...     2022: [1.2, 2.3, 8.9, 4.5, 4.4, 3, 2, 1],
        ...     2023: [3.4, 9.0, 7.2, 5.2, 8.8, 9.4, 8.2, 1.0],
        ... }
        >>> df = pd.DataFrame(
        ...     data, index=["SPX", "CAC", "SPX", "CAC", "SPX", "CAC", "SPX", "CAC"]
        ... )
        >>> df
             2022  2023
        SPX   1.2   3.4
        CAC   2.3   9.0
        SPX   8.9   7.2
        CAC   4.5   5.2
        SPX   4.4   8.8
        CAC   3.0   9.4
        SPX   2.0   8.2
        CAC   1.0   1.0
        >>> df.groupby(level=0).ohlc()
            2022                 2023
            open high  low close open high  low close
        CAC  2.3  4.5  1.0   1.0  9.0  9.4  1.0   1.0
        SPX  1.2  8.9  1.2   2.0  3.4  8.8  3.4   8.2

        For Resampler:

        >>> ser = pd.Series(
        ...     [1, 3, 2, 4, 3, 5],
        ...     index=pd.DatetimeIndex(
        ...         [
        ...             "2023-01-01",
        ...             "2023-01-10",
        ...             "2023-01-15",
        ...             "2023-02-01",
        ...             "2023-02-10",
        ...             "2023-02-15",
        ...         ]
        ...     ),
        ... )
        >>> ser.resample("MS").ohlc()
                    open  high  low  close
        2023-01-01     1     3    1      2
        2023-02-01     4     5    3      5
        r©   zNo numeric types to aggregateÚohlcr   r  r¨  )ÚopenÚhighÚlowÚclose)r  r:  c                ó"   — | j                  «       S rf   )r  )Úsgbs    rj   r¹   zGroupBy.ohlc.<locals>.<lambda>Ž  s   € ¸C¿H¹H»J€ rl   )r‘   r$  rÛ   r2   r‘  r&   rœ   r­  r   Ú_constructor_expanddimr  r—   r=  Ú_apply_to_column_groupbys)rh   r‘   Ú
is_numericrœ  Ú	agg_namesrî   s         rj   r  zGroupBy.ohlc  sÆ   € ð| �8‰8�=‰=˜AÒØ×$Ñ$ˆCä)¨#¯)©)Ó4ˆJÙÜÐ ?Ó@Ð@àŸ™×8Ñ8Ø—‘˜V¨!°rð 9ó ˆJò 9ˆIØ—X‘X×4Ñ4Ø $§-¡-×"<Ñ"<Àið 5ó ˆFð —=’=Ø×+Ñ+Ó-�ØˆMà×/Ñ/Ñ0FÓGˆØˆrl   c                ó  ‡‡‡— | j                   }t        |«      dk(  r]|j                  ‰‰‰¬«      }|j                  dk(  r|}n|j	                  «       }|j                  «       j                  j                  d d S t        j                  | dd«      5  | j                  ˆˆˆfd„|d¬«      }d d d «       j	                  «       }| j                  s*| j                  |«      }t        t        |«      «      |_        |S # 1 sw Y   ŒQxY w)Nr   ©ÚpercentilesÚincludeÚexcluder©   r—   Tc                ó,   •— | j                  ‰‰‰¬«      S )Nr‹  )Údescribe)r  rŽ  r�  rŒ  s    €€€rj   r¹   z"GroupBy.describe.<locals>.<lambda>¥  s   ø€ ˜!Ÿ*™*Ø +°WÀgð %ó € rl   r�  )rÚ   r®   r�  r$  Úunstackr>  r[   rç   rå   rË  r
  r—   rI  rO   r  )rh   rŒ  r�  rŽ  r‘   Ú	describedrî   s    ```   rj   r�  zGroupBy.describe‘  sø   ú€ ð ×'Ñ'ˆäˆs‹8�qŠ=ØŸ™Ø'°À'ð %ó ˆIð �x‰x˜1Š}Ø"‘à"×*Ñ*Ó,�Ø—?‘?Ó$×&Ñ&×+Ñ+¨B¨QÐ/Ð/ä×Ñ˜d J°Ó5ñ 	Ø×/Ñ/õð Ø!%ð 0ó ˆF÷	ð —‘Ó!ˆØ�}Š}Ø×0Ñ0°Ó8ˆFÜ(¬¨V«Ó5ˆFŒLàˆ÷	ð 	ús   ÂC<Ã<Dc	               óL   — ddl m} |	rt        d«      ‚ || |f|||||||dœ|
¤ŽS )a  
        Provide resampling within each group of a groupby.

        Given a grouper, the function resamples it according to a string
        "string" -> "frequency".

        See the :ref:`frequency aliases <timeseries.offset_aliases>`
        documentation for more details.

        Parameters
        ----------
        rule : str or DateOffset
            The offset string or object representing target grouper conversion.
        closed : {'right', 'left'}, optional
            Which side of bin interval is closed. See :meth:`Series.resample`.
        label : {'right', 'left'}, optional
            Which bin edge label to label bucket with. See :meth:`Series.resample`.
        convention : {'start', 'end', 's', 'e'}, optional
            For ``PeriodIndex`` only. See :meth:`Series.resample`.
        on : str, optional
            For a DataFrame, column to use instead of index for resampling.
            Column must be datetime-like.
        origin : Timestamp or str, default 'start_day'
            The timestamp on which to adjust the grouping. See
            :meth:`Series.resample` for accepted string values.
        offset : Timedelta or str, optional
            An offset timedelta added to the origin.
        group_keys : bool, default False
            Whether to include the group keys in the result index when using
            ``.apply()`` on the resampled object.
        include_groups : bool, default False
            When True, will attempt to include the groupings in the operation in
            the case that they are columns of the DataFrame. If this raises a
            TypeError, the result will be computed with the groupings excluded.
            When False, the groupings will be excluded when applying ``func``.

            .. versionadded:: 2.2.0

            .. versionchanged:: 3.0

               The default was changed to False, and True is no longer allowed.

        **kwargs
            Additional keyword arguments forwarded to the underlying
            :class:`Grouper`.

        Returns
        -------
        DatetimeIndexResampler, PeriodIndexResampler or TimedeltaResampler
            Resampler object for the type of the index.

        See Also
        --------
        Series.resample : Resample a Series.
        DataFrame.resample : Resample a DataFrame.
        Grouper : Specify a frequency to resample with when
            grouping by a key.
        DatetimeIndex.resample : Frequency conversion and resampling of
            time series.

        Examples
        --------
        >>> idx = pd.date_range("1/1/2000", periods=4, freq="min")
        >>> df = pd.DataFrame(data=4 * [range(2)], index=idx, columns=["a", "b"])
        >>> df.iloc[2, 0] = 5
        >>> df
                            a  b
        2000-01-01 00:00:00  0  1
        2000-01-01 00:01:00  0  1
        2000-01-01 00:02:00  5  1
        2000-01-01 00:03:00  0  1

        Downsample the DataFrame into 3 minute bins and sum the values of
        the timestamps falling into a bin.

        >>> df.groupby("a").resample("3min").sum()
                                 b
        a
        0   2000-01-01 00:00:00  2
            2000-01-01 00:03:00  1
        5   2000-01-01 00:00:00  1

        Upsample the series into 30 second bins.

        >>> df.groupby("a").resample("30s").sum()
                            b
        a
        0   2000-01-01 00:00:00  1
            2000-01-01 00:00:30  0
            2000-01-01 00:01:00  1
            2000-01-01 00:01:30  0
            2000-01-01 00:02:00  0
            2000-01-01 00:02:30  0
            2000-01-01 00:03:00  1
        5   2000-01-01 00:02:00  1

        Resample by month. Values are assigned to the month of the period.

        >>> df.groupby("a").resample("ME").sum()
                    b
        a
        0   2000-01-31  3
        5   2000-01-31  1

        Downsample the series into 3 minute bins as above, but close the right
        side of the bin interval.

        >>> (df.groupby("a").resample("3min", closed="right").sum())
                                 b
        a
        0   1999-12-31 23:57:00  1
            2000-01-01 00:00:00  2
        5   2000-01-01 00:00:00  1

        Downsample the series into 3 minute bins and close the right side of
        the bin interval, but label each bin using the right edge instead of
        the left.

        >>> (df.groupby("a").resample("3min", closed="right", label="right").sum())
                                 b
        a
        0   2000-01-01 00:00:00  1
            2000-01-01 00:03:00  2
        5   2000-01-01 00:03:00  1
        r   )Úget_resampler_for_groupingrƒ  )ÚonÚclosedr|   Ú
conventionÚoriginÚoffsetrš   )Úpandas.core.resampler”  rÏ   )rh   Úruler–  r|   r—  r•  r˜  r™  rš   r�  rr   r”  s               rj   ÚresamplezGroupBy.resample´  sQ   € õX 	DáÜÐHÓIÐIá)ØØð
ð ØØØ!ØØØ!ñ
ð ñ
ð 	
rl   c                ón   — ddl m}  || j                  |||||||| j                  | j                  ¬«
      S )a�  
        Return a rolling grouper, providing rolling functionality per group.

        Allows the application of rolling window operations
        (e.g., moving averages) independently within each group defined
        by the groupby keys.

        Parameters
        ----------
        window : int, timedelta, str, offset, or BaseIndexer subclass
            Interval of the moving window.

            If an integer, the delta between the start and end of each window.
            The number of points in the window depends on the ``closed`` argument.

            If a timedelta, str, or offset, the time period of each window. Each
            window will be a variable sized based on the observations included in
            the time-period. This is only valid for datetimelike indexes.
            The offset must correspond to a fixed frequency (for example, ``'2D'``
            or ``'1h'``); non-fixed frequencies such as ``'B'`` (business day) or
            ``'ME'`` (month end) are not supported and raise ``ValueError``.
            To learn more about the offsets & frequency strings, please see
            :ref:`this link<timeseries.offset_aliases>`.

            If a BaseIndexer subclass, the window boundaries
            based on the defined ``get_window_bounds`` method. Additional rolling
            keyword arguments, namely ``min_periods``, ``center``, ``closed`` and
            ``step`` will be passed to ``get_window_bounds``.

        min_periods : int, default None
            Minimum number of observations in window required to have a value;
            otherwise, result is ``np.nan``.

            For a window that is specified by an offset,
            ``min_periods`` will default to 1.

            For a window that is specified by an integer, ``min_periods`` will default
            to the size of the window.

        center : bool, default False
            If False, set the window labels as the right edge of the window index.

            If True, set the window labels as the center of the window index.

        win_type : str, default None
            If ``None``, all points are evenly weighted.

            If a string, it must be a valid `scipy.signal window function
            <https://docs.scipy.org/doc/scipy/reference/signal.windows.html#module-scipy.signal.windows>`__.

            Certain Scipy window types require additional parameters to be passed
            in the aggregation function. The additional parameters must match
            the keywords specified in the Scipy window type method signature.

        on : str, optional
            For a DataFrame, a column label or Index level on which
            to calculate the rolling window, rather than the DataFrame's index.

            For integer ``window`` values, the window bounds are based on the number
            of observations and are not calculated using the values of the
            ``on`` column. The ``on`` column is excluded from the aggregation,
            but is included in the result when its values differ from the
            object's index.

        closed : str, default None
            Determines the inclusivity of points in the window

            If ``'right'``, uses the window (first, last] meaning the last point
            is included in the calculations.

            If ``'left'``, uses the window [first, last) meaning the first point
            is included in the calculations.

            If ``'both'``, uses the window [first, last] meaning all points in
            the window are included in the calculations.

            If ``'neither'``, uses the window (first, last) meaning the first
            and last points in the window are excluded from calculations.

            () and [] are referencing open and closed set
            notation respetively.

            Default ``None`` (``'right'``).

        method : str {'single', 'table'}, default 'single'
            Execute the rolling operation per single column or row (``'single'``)
            or over the entire object (``'table'``).

            This argument is only implemented when specifying ``engine='numba'``
            in the method call.

        Returns
        -------
        pandas.api.typing.RollingGroupBy
            Return a new grouper with our rolling appended.

        See Also
        --------
        Series.rolling : Calling object with Series data.
        DataFrame.rolling : Calling object with DataFrames.
        Series.groupby : Apply a function groupby to a Series.
        DataFrame.groupby : Apply a function groupby.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "A": [1, 1, 2, 2],
        ...         "B": [1, 2, 3, 4],
        ...         "C": [0.362, 0.227, 1.267, -0.562],
        ...     }
        ... )
        >>> df
              A  B      C
        0     1  1  0.362
        1     1  2  0.227
        2     2  3  1.267
        3     2  4 -0.562

        >>> df.groupby("A").rolling(2).sum()
            B      C
        A
        1 0  NaN    NaN
          1  3.0  0.589
        2 2  NaN    NaN
          3  7.0  0.705

        >>> df.groupby("A").rolling(2, min_periods=1).sum()
            B      C
        A
        1 0  1.0  0.362
          1  3.0  0.589
        2 2  3.0  1.267
          3  7.0  0.705

        >>> df.groupby("A").rolling(2, on="B").sum()
            B      C
        A
        1 0  1    NaN
          1  2  0.589
        2 2  3    NaN
          3  4  0.705
        r   )rb   )	Úwindowr  ÚcenterÚwin_typer•  r–  r  rœ   Ú	_as_index)Úpandas.core.windowrb   rÛ   rœ   r—   )	rh   rž  r  rŸ  r   r•  r–  r  rb   s	            rj   ÚrollingzGroupBy.rollingR  sA   € õt 	6áØ×ÑØØ#ØØØØØØ—]‘]Ø—m‘mô
ð 	
rl   c                óN   — ddl m}  || j                  ||| j                  ¬«      S )a  
        Return an expanding grouper, providing expanding functionality per group.

        Each group's expanding window includes all prior rows within that
        group up to and including the current row.

        Parameters
        ----------
        min_periods : int, default 1
            Minimum number of observations in window required to have a value;
            otherwise, result is ``np.nan``.

        method : str {'single', 'table'}, default 'single'
            Execute the expanding operation per single column or row (``'single'``)
            or over the entire object (``'table'``).

            This argument is only implemented when specifying ``engine='numba'``
            in the method call.

        Returns
        -------
        pandas.api.typing.ExpandingGroupBy
            An object that supports expanding transformations over each group.

        See Also
        --------
        Series.expanding : Expanding transformations for Series.
        DataFrame.expanding : Expanding transformations for DataFrames.
        Series.groupby : Apply a function groupby to a Series.
        DataFrame.groupby : Apply a function groupby.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "Class": ["A", "A", "A", "B", "B", "B"],
        ...         "Value": [10, 20, 30, 40, 50, 60],
        ...     }
        ... )
        >>> df
        Class  Value
        0     A     10
        1     A     20
        2     A     30
        3     B     40
        4     B     50
        5     B     60

        >>> df.groupby("Class").expanding().mean()
                Value
        Class
        A     0   10.0
              1   15.0
              2   20.0
        B     3   40.0
              4   45.0
              5   50.0
        r   )r`   )r  r  rœ   )r¢  r`   rÛ   rœ   )rh   r  r  r`   s       rj   Ú	expandingzGroupBy.expandingû  s+   € õ@ 	8áØ×ÑØ#ØØ—]‘]ô	
ð 	
rl   c
                ó\   — ddl m}
  |
| j                  |||||||||	| j                  ¬«      S )a
  
        Return an ewm grouper, providing ewm functionality per group.

        The decay can be specified in terms of center of mass, span,
        half-life, or smoothing factor alpha.

        Parameters
        ----------
        com : float, optional
            Specify decay in terms of center of mass.
            Alternative to ``span``, ``halflife``, and ``alpha``.

        span : float, optional
            Specify decay in terms of span.

        halflife : float, str, or Timedelta, optional
            Specify decay in terms of half-life.

        alpha : float, optional
            Specify smoothing factor directly.

        min_periods : int, default 0
            Minimum number of observations in the window required to have a value;
            otherwise, result is ``np.nan``.

        adjust : bool, default True
            Divide by decaying adjustment factor to account for imbalance in
            relative weights.

        ignore_na : bool, default False
            Ignore missing values when calculating weights.

        times : str or array-like of datetime64, optional
            Times corresponding to the observations.

        method : {'single', 'table'}, default 'single'
            Execute the operation per group independently (``'single'``) or over the
            entire object before regrouping (``'table'``). Only applicable to
            ``mean()``, and only when using ``engine='numba'``.

        Returns
        -------
        pandas.api.typing.ExponentialMovingWindowGroupBy
            An object that supports exponentially weighted moving transformations over
            each group.

        See Also
        --------
        Series.ewm : EWM transformations for Series.
        DataFrame.ewm : EWM transformations for DataFrames.
        Series.groupby : Apply a function groupby to a Series.
        DataFrame.groupby : Apply a function groupby.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "Class": ["A", "A", "A", "B", "B", "B"],
        ...         "Value": [10, 20, 30, 40, 50, 60],
        ...     }
        ... )
        >>> df
        Class  Value
        0     A     10
        1     A     20
        2     A     30
        3     B     40
        4     B     50
        5     B     60

        >>> df.groupby("Class").ewm(com=0.5).mean()
                     Value
        Class
        A     0  10.000000
              1  17.500000
              2  26.153846
        B     3  40.000000
              4  47.500000
              5  56.153846
        r   )ra   )
rå   ÚspanÚhalflifeÚalphar  ÚadjustÚ	ignore_naÚtimesr  rœ   )r¢  ra   rÛ   rœ   )rh   rå   r§  r¨  r©  r  rª  r«  r¬  r  ra   s              rj   ÚewmzGroupBy.ewmD  sA   € õz 	Fá-Ø×ÑØØØØØ#ØØØØØ—]‘]ô
ð 	
rl   c                óT  ‡ ‡	— |€d}‰ j                   j                  }‰ j                   j                  }t        t        j
                  |||dk(  |¬«      Š	dˆ	ˆ fd„}‰ j                  «       }|j                  |«      }‰ j                  |«      }‰ j                  j                  |_
        |S )aõ  
        Shared function for `pad` and `backfill` to call Cython method.

        Parameters
        ----------
        direction : {'ffill', 'bfill'}
            Direction passed to underlying Cython function. `bfill` will cause
            values to be filled backwards. `ffill` and any other values will
            default to a forward fill
        limit : int, default None
            Maximum number of consecutive values to fill. If `None`, this
            method will convert to -1 prior to passing to Cython

        Returns
        -------
        `Series` or `DataFrame` with filled values

        See Also
        --------
        pad : Forward fill values within each group.
        backfill : Backward fill values within each group.
        r  Úffill)r*  ÚlimitÚcompute_ffillr¢   c                óþ  •— t        | «      }| j                  dk(  rOt        j                  | j                  t        j
                  ¬«      } ‰||¬«       t        j                  | |«      S t        | t        j                  «      rY| j                  }‰j                  j                  rt        | j                  «      }t        j                  | j                  |¬«      }n0t        | «      j                  | j                  | j                  ¬«      }t!        | «      D ]a  \  }}t        j                  | j                  d   t        j
                  ¬«      } ‰|||   ¬«       t        j                  ||«      ||d d …f<   Œc |S )Nr©   r�  )rÀ  r+  )r7   r$  r¾   rÝ  r“  ræ  r:   rÕ  r¬   Úndarrayr‘  rœ   r  r+   rú   Ú_emptyrB  )	r&  r+  r-  r‘  rÀ  ÚiÚvalue_elementÚcol_funcrh   s	          €€rj   Úblk_funczGroupBy._fill.<locals>.blk_funcØ  s  ø€ Ü˜“<ˆDØ�{‰{˜aÒÜŸ(™( 6§<¡<´r·w±wÔ?�Ù˜W¨4Õ0Ü!×)Ñ)¨&°'Ó:Ð:ô
 ˜f¤b§j¡jÔ1Ø"ŸL™L�EØ—}‘}×3Ò3ä 8¸¿¹Ó F˜ÜŸ(™( 6§<¡<°uÔ=‘Cô ˜v›,×-Ñ-¨f¯l©lÀ&Ç,Á,Ð-ÓO�Cä(1°&Ó(9ò KÑ$�A�}ä Ÿh™h v§|¡|°A¡¼b¿g¹gÔF�GÙ ¨t°A©wÕ7Ü *× 2Ñ 2°=À'Ó J�C˜š1˜’Ið	Kð
 �
rl   rº  )rœ   r  r¢   r
   Ú
libgroupbyÚgroup_fillna_indexerr»  rf  r½  r‘   r  )
rh   Ú	directionr°  r  r¢   r¸  Úmgrrn  r	  r·  s
   `        @rj   Ú_fillzGroupBy._fill±  s˜   ù€ ð2 ˆ=ØˆEà�m‰m×ÑˆØ—-‘-×'Ñ'ˆäÜ×+Ñ+ØØØ$¨Ñ/Øô
ˆö	ð< ×)Ñ)Ó+ˆØ—)‘)˜HÓ%ˆà×*Ñ*¨7Ó3ˆØŸ™Ÿ™ˆŒØˆrl   c                ó(   — | j                  d|¬«      S )a‚	  
        Forward fill the values.

        Propagates the last valid observation forward within each group
        to fill missing values.

        Parameters
        ----------
        limit : int, optional
            Limit of how many values to fill.

        Returns
        -------
        Series or DataFrame
            Object with missing values filled.

        See Also
        --------
        Series.ffill : Forward fill missing values in a Series.
        DataFrame.ffill : Forward fill missing values in a DataFrame.
        Series.fillna: Fill NaN values of a Series.
        DataFrame.fillna: Fill NaN values of a DataFrame.

        Examples
        --------

        For SeriesGroupBy:

        >>> key = [0, 0, 1, 1]
        >>> ser = pd.Series([np.nan, 2, 3, np.nan], index=key)
        >>> ser
        0    NaN
        0    2.0
        1    3.0
        1    NaN
        dtype: float64
        >>> ser.groupby(level=0).ffill()
        0    NaN
        0    2.0
        1    3.0
        1    3.0
        dtype: float64

        For DataFrameGroupBy:

        >>> df = pd.DataFrame(
        ...     {
        ...         "key": [0, 0, 1, 1, 1],
        ...         "A": [np.nan, 2, np.nan, 3, np.nan],
        ...         "B": [2, 3, np.nan, np.nan, np.nan],
        ...         "C": [np.nan, np.nan, 2, np.nan, np.nan],
        ...     }
        ... )
        >>> df
           key    A    B   C
        0    0  NaN  2.0 NaN
        1    0  2.0  3.0 NaN
        2    1  NaN  NaN 2.0
        3    1  3.0  NaN NaN
        4    1  NaN  NaN NaN

        Propagate non-null values forward or backward within each group along columns.

        >>> df.groupby("key").ffill()
             A    B   C
        0  NaN  2.0 NaN
        1  2.0  3.0 NaN
        2  NaN  NaN 2.0
        3  3.0  NaN 2.0
        4  3.0  NaN 2.0

        Propagate non-null values forward or backward within each group along rows.

        >>> df.T.groupby(np.array([0, 0, 1, 1])).ffill().T
           key    A    B    C
        0  0.0  0.0  2.0  2.0
        1  0.0  2.0  3.0  3.0
        2  1.0  1.0  NaN  2.0
        3  1.0  3.0  NaN  NaN
        4  1.0  1.0  NaN  NaN

        Only replace the first NaN element within a group along columns.

        >>> df.groupby("key").ffill(limit=1)
             A    B    C
        0  NaN  2.0  NaN
        1  2.0  3.0  NaN
        2  NaN  NaN  2.0
        3  3.0  NaN  2.0
        4  3.0  NaN  NaN
        r¯  ©r°  ©r½  ©rh   r°  s     rj   r¯  zGroupBy.ffillý  s   € ðz �z‰z˜'¨ˆzÓ/Ð/rl   c                ó(   — | j                  d|¬«      S )a-  
        Backward fill the values.

        Fill missing values within each group by propagating the next
        valid observation backward.

        Parameters
        ----------
        limit : int, optional
            Limit of how many values to fill.

        Returns
        -------
        Series or DataFrame
            Object with missing values filled.

        See Also
        --------
        Series.bfill :  Backward fill the missing values in the dataset.
        DataFrame.bfill:  Backward fill the missing values in the dataset.
        Series.fillna: Fill NaN values of a Series.
        DataFrame.fillna: Fill NaN values of a DataFrame.

        Examples
        --------

        With Series:

        >>> index = ["Falcon", "Falcon", "Parrot", "Parrot", "Parrot"]
        >>> s = pd.Series([None, 1, None, None, 3], index=index)
        >>> s
        Falcon    NaN
        Falcon    1.0
        Parrot    NaN
        Parrot    NaN
        Parrot    3.0
        dtype: float64
        >>> s.groupby(level=0).bfill()
        Falcon    1.0
        Falcon    1.0
        Parrot    3.0
        Parrot    3.0
        Parrot    3.0
        dtype: float64
        >>> s.groupby(level=0).bfill(limit=1)
        Falcon    1.0
        Falcon    1.0
        Parrot    NaN
        Parrot    3.0
        Parrot    3.0
        dtype: float64

        With DataFrame:

        >>> df = pd.DataFrame(
        ...     {"A": [1, None, None, None, 4], "B": [None, None, 5, None, 7]},
        ...     index=index,
        ... )
        >>> df
                  A	    B
        Falcon	1.0	  NaN
        Falcon	NaN	  NaN
        Parrot	NaN	  5.0
        Parrot	NaN	  NaN
        Parrot	4.0	  7.0
        >>> df.groupby(level=0).bfill()
                  A	    B
        Falcon	1.0	  NaN
        Falcon	NaN	  NaN
        Parrot	4.0	  5.0
        Parrot	4.0	  7.0
        Parrot	4.0	  7.0
        >>> df.groupby(level=0).bfill(limit=1)
                  A	    B
        Falcon	1.0	  NaN
        Falcon	NaN	  NaN
        Parrot	NaN	  5.0
        Parrot	4.0	  7.0
        Parrot	4.0	  7.0
        Úbfillr¿  rÀ  rÁ  s     rj   rÃ  zGroupBy.bfill\  s   € ðd �z‰z˜'¨ˆzÓ/Ð/rl   c                ó   — t        | «      S )aª  
        Take the nth row from each group if n is an int, otherwise a subset of rows.

        .. deprecated:: 3.1.0

            Index notation (``g.nth[n]``) is deprecated in favor of calling
            ``g.nth(n)`` and will be removed in a future version of pandas.

        If dropna, will take the nth non-null row, dropna is either
        'all' or 'any'; this is equivalent to calling dropna(how=dropna)
        before the groupby.

        Returns
        -------
        Series or DataFrame
            N-th value within each group.

        See Also
        --------
        Series.nth : Apply function nth to a Series.
        DataFrame.nth : Apply function nth to each row or column of a DataFrame.

        Examples
        --------

        >>> df = pd.DataFrame(
        ...     {"A": [1, 1, 2, 1, 2], "B": [np.nan, 2, 3, 4, 5]}, columns=["A", "B"]
        ... )
        >>> g = df.groupby("A")
        >>> g.nth(0)
           A   B
        0  1 NaN
        2  2 3.0
        >>> g.nth(1)
           A   B
        1  1 2.0
        4  2 5.0
        >>> g.nth(-1)
           A   B
        3  1 4.0
        4  2 5.0
        >>> g.nth([0, 1])
           A   B
        0  1 NaN
        1  1 2.0
        2  2 3.0
        4  2 5.0
        >>> g.nth(slice(None, -1))
           A   B
        0  1 NaN
        1  1 2.0
        2  2 3.0

        Specifying `dropna` allows ignoring ``NaN`` values

        >>> g.nth(0, dropna="any")
           A   B
        1  1 2.0
        2  2 3.0

        When the specified ``n`` is larger than any of the groups, an
        empty DataFrame is returned

        >>> g.nth(3, dropna="any")
        Empty DataFrame
        Columns: [A, B]
        Index: []
        )rL   r£   s    rj   ÚnthzGroupBy.nth°  s   € ôN " $Ó'Ð'rl   c                ó  — |sB| j                  |«      }| j                  j                  }||dk7  z  }| j                  |«      }|S t	        |«      st        d«      ‚|dvrt        d|› d�«      ‚t        d|«      }| j                  j                  |d¬«      }t        |«      t        | j                  «      k(  r| j                  }nŒ| j                  j                  }| j                  j                  |j                  |j                  «         }| j                  j                  r.|dk(  }	t        j                   |	t"        |«      }
t%        |
d	d
¬«      }|j'                  || j(                  | j*                  ¬«      }|j-                  |«      S )Nr  z4dropna option only supported for an integer argumentr£  z_For a DataFrame or Series groupby.nth, dropna must be either None, 'any' or 'all', (was passed z).rð   r   )r™  r  ÚInt64F)r‘  r}   )r—   r“   )Ú"_make_mask_from_positional_indexerrœ   r  Ú_mask_selected_objr/   rÏ   r   rÛ   r•   r®   r  Ú
codes_infoÚisinr  r  r¾   r¯  r   rM   ri   r—   r“   rÅ  )rh   rÉ   r•   r+  r  rÀ  Údroppedr–   r  Únullsr&  Úgrbs               rj   Ú_nthzGroupBy._nthù  sd  € ñ
 Ø×:Ñ:¸1Ó=ˆDà—-‘-×#Ñ#ˆCð ˜3 "™9Ñ%ˆDà×)Ñ)¨$Ó/ˆCØˆJô ˜!Œ}ÜÐSÓTÐTà˜Ñ'äðà%˜h bð*óð ô �˜‹NˆØ×$Ñ$×+Ñ+°¸QÐ+Ó?ˆô ˆw‹<œ3˜t×1Ñ1Ó2Ò2à—m‘m‰Gð
 —=‘=×%Ñ%ˆDØ—m‘m×.Ñ.¨t¯y©y¸¿¹Ó/GÑHˆGØ�}‰}×+Ò+à 2™�ô Ÿ™ %¬¨WÓ5�Ü ¨g¸EÔB�à�o‰o˜g°·±ÀDÇIÁIˆoÓNˆØ�w‰w�q‹zÐrl   c           	     ó$  ‡‡‡‡‡‡‡‡— | j                  |d¬«      }| j                  |«      }| j                  j                  |«      }|j                  }t        j                  |j                  |j                  «      \  ŠŠt        |«      r)t        j                  |gt        j                  ¬«      Šd}n't        j                  |t        j                  ¬«      Š‰}| j                  j                  Š| j                  j                  Š| j                  r‰‰dk\     Št!        ‰«      Št#        t$        j&                  ‰‰‰‰‰¬«      Šd	ˆˆˆˆˆˆˆˆfd„}	|j(                  j+                  |	«      }
| j                  |
«      }| j-                  ||¬«      S )
a¡  
        Return group values at the given quantile, a la numpy.percentile.

        This method returns the value at the given quantile for each group,
        using the specified interpolation method when the desired quantile
        falls between two data points.

        Parameters
        ----------
        q : float or array-like, default 0.5 (50% quantile)
            Value(s) between 0 and 1 providing the quantile(s) to compute.
        interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
            Method to use when the desired quantile falls between two points.
        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.

            .. versionchanged:: 2.0.0

                numeric_only now defaults to ``False``.

        Returns
        -------
        Series or DataFrame
            Return type determined by caller of GroupBy object.

        See Also
        --------
        Series.quantile : Similar method for Series.
        DataFrame.quantile : Similar method for DataFrame.
        numpy.percentile : NumPy method to compute qth percentile.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     [["a", 1], ["a", 2], ["a", 3], ["b", 1], ["b", 3], ["b", 5]],
        ...     columns=["key", "val"],
        ... )
        >>> df.groupby("key").quantile()
            val
        key
        a    2.0
        b    3.0
        Úquantiler   r�  Nr   )r*  rF  Úinterpolationr_  r`  c                ó\  •— t        | t        «      r| j                  ‰‰
‰	‰‰‰¬«      S t        | j                  «      rt        d| j                  › d�«      ‚t        | j                  «      rt        d«      ‚t        | «      }t        | j                  «      r#t        j                  t        j                  «      nd }t        j                  | «      }d}|j                  dk(  r|j                  d   }t        j                  |‰‰ft        j                  ¬«      }|j                  dk(  r ‰|d   ||d d	¬
«       n&t!        |«      D ]  } ‰||   ||   ||   d d	¬
«       Œ |j                  dk(  r|j#                  d«      }n|j%                  |‰‰z  «      }|�‰
dvr|j'                  |«      }|S )N)rF  rÒ  r  r¢   r_  r`  zdtype 'z'' does not support operation 'quantile'z#Cannot use quantile with bool dtyper©   rc  r   r�  F)r&  r+  Úresult_maskÚis_datetimelikeÚK>   ÚlinearÚmidpoint)r¬   r?   Ú_groupby_quantiler3   r‘  rˆ  r-   r7   r0   r¾   rÚ  r±  r$  r“  rÝ  rå  r7  rv  r   r–  )r&  r+  Ú	inferenceÚvalsÚncolsrÀ  rµ  r`  rà   r  rÒ  r¢   ÚnqsrF  r_  s          €€€€€€€€rj   r¸  z"GroupBy.quantile.<locals>.blk_func‚  s£  ø€ Ü˜&¤.Ô1Ø×/Ñ/ØØ"/ØØ#Ø!Øð 0ó ð ô ˜vŸ|™|Ô,ÜØ˜fŸl™l˜^Ð+RÐSóð ô ˜VŸ\™\Ô*äÐ EÓFÐFä˜“<ˆDä&6°v·|±|Ô&D”—‘œŸ™Ô"È$ð ô —:‘:˜fÓ%ˆDàˆEØ�y‰y˜AŠ~ØŸ
™
 1™�ä—(‘(˜E 7¨CÐ0¼¿
¹
ÔCˆCà�y‰y˜AŠ~ÙØ˜‘FØØØ $Ø$)öô ˜u›ò �AÙØ˜A™Ø# A™wØ! !™WØ$(Ø(-öðð �y‰y˜AŠ~Ø—i‘i “n‘à—k‘k %¨°3©Ó7�àÐ$¨ð ?ñ *ð —j‘j Ó+�àˆJrl   rK  rº  )r»  r½  rœ   Ú_get_splitterÚ_sorted_datar   rX  Ú_slabelsr¢   r4   r¾   rÛ  rå  r±  r  r•   r®   r
   r¹  Úgroup_quantilere  r¼  rN  )rh   ÚqrÒ  r¡  r¼  r‘   ÚsplitterÚsdataÚpass_qsr¸  rn  r  r`  rà   r  r¢   rÝ  rF  r_  s     `         @@@@@@@rj   rÑ  zGroupBy.quantile0  sK  ÿ€ ðh ×)Ñ)°|È*Ð)ÓUˆØ×&Ñ& sÓ+ˆØ—=‘=×.Ñ.¨sÓ3ˆØ×%Ñ%ˆä×*Ñ*¨8×+<Ñ+<¸h×>NÑ>NÓO‰ˆ�ä�QŒ<Ü—‘˜1˜#¤R§Z¡ZÔ0ˆBØ)-‰Gä—‘˜A¤R§Z¡ZÔ0ˆBØˆGà�m‰m×ÑˆØ—-‘-×'Ñ'ˆØ�;Š;à�c˜Q‘h‘-ˆCÜ�"‹gˆäÜ×%Ñ%ØØØ'ØØô
ˆ÷=	ô =	ð~ —*‘*×+Ñ+¨HÓ5ˆà×&Ñ& wÓ/ˆØ×+Ñ+¨C°GÐ+Ó<Ð<rl   c                óÜ  — | j                   }|j                  }| j                  j                  }| j                  j                  r9t        j                  |dk(  t
        j                  |«      }t
        j                  }nt
        j                  }t        d„ | j                  j                  D «       «      rt        |d¬«      dz
  }| j                  |||¬«      }|s| j                  dz
  |z
  }|S )a	  
        Number each group from 0 to the number of groups - 1.

        This is the enumerative complement of cumcount.  Note that the
        numbers given to the groups match the order in which the groups
        would be seen when iterating over the groupby object, not the
        order they are first observed.

        Groups with missing keys (where `pd.isna()` is True) will be labeled with `NaN`
        and will be skipped from the count.

        Parameters
        ----------
        ascending : bool, default True
            If False, number in reverse, from number of group - 1 to 0.

        Returns
        -------
        Series
            Unique numbers for each group.

        See Also
        --------
        .cumcount : Number the rows in each group.

        Examples
        --------
        >>> df = pd.DataFrame({"color": ["red", None, "red", "blue", "blue", "red"]})
        >>> df
          color
        0   red
        1   NaN
        2   red
        3  blue
        4  blue
        5   red
        >>> df.groupby("color").ngroup()
        0    1.0
        1    NaN
        2    1.0
        3    0.0
        4    0.0
        5    1.0
        dtype: float64
        >>> df.groupby("color", dropna=False).ngroup()
        0    1
        1    2
        2    1
        3    0
        4    0
        5    1
        dtype: int64
        >>> df.groupby("color", dropna=False).ngroup(ascending=False)
        0    1
        1    0
        2    1
        3    2
        4    2
        5    1
        dtype: int64
        r  c              3  ó4   K  — | ]  }|j                   –— Œ y ­wrf   ©Ú_passed_categorical©rÄ   Úpings     rj   rÆ   z!GroupBy.ngroup.<locals>.<genexpr>  s   è ø€ ÒL¨Dˆt×'Õ'ÑLùó   ‚Údense)Úties_methodr©   r�  )rÚ   r  rœ   r  r  r¾   r¯  rÃ   rå  rÚ  r¤  r?  r   rñ  r¢   )rh   rè  r‘   r  Úcomp_idsr‘  rî   s          rj   ÚngroupzGroupBy.ngroupÆ  s¾   € ð~ ×'Ñ'ˆØ—	‘	ˆØ—=‘=×$Ñ$ˆð �=‰=×'Ò'Ü—x‘x ¨B¡´·±¸ÓAˆHÜ—J‘J‰Eä—H‘HˆEäÑL°D·M±M×4KÑ4KÔLÔLä˜x°WÔ=ÀÑAˆHà×)Ñ)¨(°EÀÐ)ÓGˆÙØ—\‘\ AÑ%¨Ñ.ˆFØˆrl   c                óv   — | j                   j                  }| j                  |¬«      }| j                  ||«      S )ae  
        Number each item in each group from 0 to the length of that group - 1.

        Essentially this is equivalent to

        .. code-block:: python

            self.apply(lambda x: pd.Series(np.arange(len(x)), x.index))

        Parameters
        ----------
        ascending : bool, default True
            If False, number in reverse, from length of group - 1 to 0.

        Returns
        -------
        Series
            Sequence number of each element within each group.

        See Also
        --------
        .ngroup : Number the groups themselves.

        Examples
        --------
        >>> df = pd.DataFrame([["a"], ["a"], ["a"], ["b"], ["b"], ["a"]], columns=["A"])
        >>> df
           A
        0  a
        1  a
        2  a
        3  b
        4  b
        5  a
        >>> df.groupby("A").cumcount()
        0    0
        1    1
        2    2
        3    0
        4    1
        5    3
        dtype: int64
        >>> df.groupby("A").cumcount(ascending=False)
        0    3
        1    2
        2    1
        3    1
        4    0
        5    0
        dtype: int64
        )rè  )rÚ   r  rî  rñ  )rh   rè  r  Ú	cumcountss       rj   ÚcumcountzGroupBy.cumcount  s<   € ðj ×)Ñ)×/Ñ/ˆØ×(Ñ(°9Ð(Ó=ˆ	Ø×'Ñ'¨	°5Ó9Ð9rl   c                ó\   — |dvrd}t        |«      ‚||||dœ} | j                  	 dddi|¤ŽS )aC  
        Provide the rank of values within each group.

        This method assigns ranks to values within each group, with options
        for handling duplicate values, NaN values, and computing percentage ranks.

        Parameters
        ----------
        method : {'average', 'min', 'max', 'first', 'dense'}, default 'average'
            * average: average rank of group.
            * min: lowest rank in group.
            * max: highest rank in group.
            * first: ranks assigned in order they appear in the array.
            * dense: like 'min', but rank always increases by 1 between groups.
        ascending : bool, default True
            False for ranks by high (1) to low (N).
        na_option : {'keep', 'top', 'bottom'}, default 'keep'
            * keep: leave NA values where they are.
            * top: smallest rank if ascending.
            * bottom: smallest rank if descending.
        pct : bool, default False
            Compute percentage rank of data within each group.

        Returns
        -------
        DataFrame
            The ranking of values within each group.

        See Also
        --------
        Series.rank : Apply function rank to a Series.
        DataFrame.rank : Apply function rank to each row or column of a DataFrame.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "group": ["a", "a", "a", "a", "a", "b", "b", "b", "b", "b"],
        ...         "value": [2, 4, 2, 3, 5, 1, 2, 4, 1, 5],
        ...     }
        ... )
        >>> df
          group  value
        0     a      2
        1     a      4
        2     a      2
        3     a      3
        4     a      5
        5     b      1
        6     b      2
        7     b      4
        8     b      1
        9     b      5
        >>> for method in ["average", "min", "max", "dense", "first"]:
        ...     df[f"{method}_rank"] = df.groupby("group")["value"].rank(method)
        >>> df
          group  value  average_rank  min_rank  max_rank  dense_rank  first_rank
        0     a      2           1.5       1.0       2.0         1.0         1.0
        1     a      4           4.0       4.0       4.0         3.0         4.0
        2     a      2           1.5       1.0       2.0         1.0         2.0
        3     a      3           3.0       3.0       3.0         2.0         3.0
        4     a      5           5.0       5.0       5.0         4.0         5.0
        5     b      1           1.5       1.0       2.0         1.0         1.0
        6     b      2           3.0       3.0       3.0         2.0         3.0
        7     b      4           4.0       4.0       4.0         3.0         4.0
        8     b      1           1.5       1.0       2.0         1.0         2.0
        9     b      5           5.0       5.0       5.0         4.0         5.0
        >   ÚtopÚkeepÚbottomz3na_option must be one of 'keep', 'top', or 'bottom')rî  rè  Ú	na_optionÚpctr¡  F)Úrank)rÏ   rÃ  )rh   r  rè  rø  rù  rÓ   rr   s          rj   rú  zGroupBy.rankR  s^   € ðX Ð5Ñ5ØGˆCÜ˜S“/Ð!ð "Ø"Ø"Øñ	
ˆð &ˆt×%Ñ%Øñ
àð
ð ñ
ð 	
rl   c                ó¬   — t        j                  d||dg«       |s|r$t        j                  dt        t        «       ¬«       | j                  d||¬«      S )al  
        Cumulative product for each group.

        Returns a Series or DataFrame of the same size with the cumulative
        product computed within each group.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.
        skipna : bool, default True
            Exclude NA/null values. If an entire row/column is NA, the result
            will be NA.
        *args : tuple
            Positional arguments to be passed to `func`.

            .. deprecated:: 3.1.0
                Passing ``*args`` to GroupBy.cumprod is deprecated
                and will be removed in a future version of pandas.

        **kwargs : dict
            Additional keyword arguments to be passed to the function.

            .. deprecated:: 3.1.0
                Passing ``**kwargs`` to GroupBy.cumprod is deprecated
                and will be removed in a future version of pandas.

        Returns
        -------
        Series or DataFrame
            Cumulative product for each group. Same object type as the caller.

        See Also
        --------
        Series.cumprod : Apply function cumprod to a Series.
        DataFrame.cumprod : Apply function cumprod to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([6, 2, 0], index=lst)
        >>> ser
        a    6
        a    2
        b    0
        dtype: int64
        >>> ser.groupby(level=0).cumprod()
        a    6
        a   12
        b    0
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 8, 2], [1, 2, 5], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["cow", "horse", "bull"]
        ... )
        >>> df
                a   b   c
        cow     1   8   2
        horse   1   2   5
        bull    2   6   9
        >>> df.groupby("a").groups
        {1: ['cow', 'horse'], 2: ['bull']}
        >>> df.groupby("a").cumprod()
                b   c
        cow     8   2
        horse  16  10
        bull    6   9
        Úcumprodr¹  zpPassing additional arguments to GroupBy.cumprod is deprecated and will be removed in a future version of pandas.rª   rõ  ©ÚnvÚvalidate_groupby_funcr¯   r°   r'   r)   rÃ  ©rh   r¡  r¹  rq   rr   s        rj   rü  zGroupBy.cumprod¯  sU   € ôb 	× Ñ  ¨D°&¸8¸*ÔEÙ‘6Ü�M‰MðEäÜ+Ó-õ	ð ×%Ñ% i°ÀfÐ%ÓMÐMrl   c                ó¬   — t        j                  d||dg«       |s|r$t        j                  dt        t        «       ¬«       | j                  d||¬«      S )al  
        Cumulative sum for each group.

        Returns a Series or DataFrame of the same size with the cumulative
        sum computed within each group.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.
        skipna : bool, default True
            Exclude NA/null values. If an entire row/column is NA, the result
            will be NA.
        *args : tuple
            Positional arguments to be passed to `func`.

            .. deprecated:: 3.1.0
                Passing ``*args`` to GroupBy.cumsum is deprecated
                and will be removed in a future version of pandas.

        **kwargs : dict
            Additional keyword arguments to be passed to the function.

            .. deprecated:: 3.1.0
                Passing ``**kwargs`` to GroupBy.cumsum is deprecated
                and will be removed in a future version of pandas.

        Returns
        -------
        Series or DataFrame
            Cumulative sum for each group. Same object type as the caller.

        See Also
        --------
        Series.cumsum : Apply function cumsum to a Series.
        DataFrame.cumsum : Apply function cumsum to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "b"]
        >>> ser = pd.Series([6, 2, 0], index=lst)
        >>> ser
        a    6
        a    2
        b    0
        dtype: int64
        >>> ser.groupby(level=0).cumsum()
        a    6
        a    8
        b    0
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 8, 2], [1, 2, 5], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["fox", "gorilla", "lion"]
        ... )
        >>> df
                  a   b   c
        fox       1   8   2
        gorilla   1   2   5
        lion      2   6   9
        >>> df.groupby("a").groups
        {1: ['fox', 'gorilla'], 2: ['lion']}
        >>> df.groupby("a").cumsum()
                  b   c
        fox       8   2
        gorilla  10   7
        lion      6   9
        rä  r¹  zoPassing additional arguments to GroupBy.cumsum is deprecated and will be removed in a future version of pandas.rª   rõ  rý  r   s        rj   rä  zGroupBy.cumsum
  sU   € ôb 	× Ñ  ¨4°¸(¸ÔDÙ‘6Ü�M‰MðEäÜ+Ó-õ	ð ×%Ñ% h°ÀVÐ%ÓLÐLrl   c                óv   — |r$t        j                  dt        t        «       ¬«       | j	                  d||¬«      S )aö  
        Cumulative min for each group.

        Returns a same-sized object where each value is replaced by the
        minimum of all preceding values in its group.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.
        skipna : bool, default True
            Exclude NA/null values. If an entire row/column is NA, the result
            will be NA.
        **kwargs : dict, optional
            Additional keyword arguments to be passed to the function.

            .. deprecated:: 3.1.0
                Passing ``**kwargs`` to GroupBy.cummin is deprecated
                and will be removed in a future version of pandas.

        Returns
        -------
        Series or DataFrame
            Cumulative min for each group. Same object type as the caller.

        See Also
        --------
        Series.cummin : Apply function cummin to a Series.
        DataFrame.cummin : Apply function cummin to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "a", "b", "b", "b"]
        >>> ser = pd.Series([1, 6, 2, 3, 0, 4], index=lst)
        >>> ser
        a    1
        a    6
        a    2
        b    3
        b    0
        b    4
        dtype: int64
        >>> ser.groupby(level=0).cummin()
        a    1
        a    1
        a    1
        b    3
        b    0
        b    0
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 0, 2], [1, 1, 5], [6, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["snake", "rabbit", "turtle"]
        ... )
        >>> df
                a   b   c
        snake   1   0   2
        rabbit  1   1   5
        turtle  6   6   9
        >>> df.groupby("a").groups
        {1: ['snake', 'rabbit'], 6: ['turtle']}
        >>> df.groupby("a").cummin()
                b   c
        snake   0   2
        rabbit  0   2
        turtle  6   9
        zoPassing additional arguments to GroupBy.cummin is deprecated and will be removed in a future version of pandas.rª   Úcumminr  ©r¯   r°   r'   r)   rÃ  ©rh   r¡  r¹  rr   s       rj   r  zGroupBy.cummine  sD   € ñ^ Ü�M‰MðEäÜ+Ó-õ	ð ×%Ñ%Ø <¸ð &ó 
ð 	
rl   c                óv   — |r$t        j                  dt        t        «       ¬«       | j	                  d||¬«      S )aW  
        Cumulative max for each group.

        Returns the cumulative maximum of values within each group. The result
        has the same size as the input, with each element representing the
        maximum of all preceding elements (including itself) within its group.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.
        skipna : bool, default True
            Exclude NA/null values. If an entire row/column is NA, the result
            will be NA.
        **kwargs : dict, optional
            Additional keyword arguments to be passed to the function.

            .. deprecated:: 3.1.0
                Passing ``**kwargs`` to GroupBy.cummax is deprecated
                and will be removed in a future version of pandas.

        Returns
        -------
        Series or DataFrame
            Cumulative max for each group. Same object type as the caller.

        See Also
        --------
        Series.cummax : Apply function cummax to a Series.
        DataFrame.cummax : Apply function cummax to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "a", "b", "b", "b"]
        >>> ser = pd.Series([1, 6, 2, 3, 1, 4], index=lst)
        >>> ser
        a    1
        a    6
        a    2
        b    3
        b    1
        b    4
        dtype: int64
        >>> ser.groupby(level=0).cummax()
        a    1
        a    6
        a    6
        b    3
        b    3
        b    4
        dtype: int64

        For DataFrameGroupBy:

        >>> data = [[1, 8, 2], [1, 1, 0], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data, columns=["a", "b", "c"], index=["cow", "horse", "bull"]
        ... )
        >>> df
                a   b   c
        cow     1   8   2
        horse   1   1   0
        bull    2   6   9
        >>> df.groupby("a").groups
        {1: ['cow', 'horse'], 2: ['bull']}
        >>> df.groupby("a").cummax()
                b   c
        cow     8   2
        horse   8   2
        bull    6   9
        zoPassing additional arguments to GroupBy.cummax is deprecated and will be removed in a future version of pandas.rª   Úcummaxr  r  r  s       rj   r  zGroupBy.cummax¿  sD   € ñ` Ü�M‰MðEäÜ+Ó-õ	ð ×%Ñ%Ø <¸ð &ó 
ð 	
rl   c           	     ó  ‡‡‡— t        |«      r.t        d|«      }t        |«      dk(  rt        d«      ‚ddlm} d}nBt        |«      st        d|› dt        |«      › d�«      ‚|rt        d	«      ‚t        d
|«      g}d}g }|D �]i  Št        ‰«      st        d‰› dt        ‰«      › d�«      ‚‰�&ˆˆˆfd„}| j                  || j                  d¬«      }	n´‰t        j                  u rdŠ| j                  j                  }
| j                  j                  }t!        j"                  t        |
«      t         j$                  ¬«      }t'        j(                  ||
|‰«       | j*                  }|j-                  d|j.                  |fi‰d¬«      }	|rGt1        |	t2        «      rt        d|	j5                  «       «      }	|	j7                  |r|› d‰› �nd‰› �«      }	|j9                  t        d|	«      «       �Œl t        |«      dk(  r|d   S  |dd¬«      S )aŽ  
        Shift each group by periods observations.

        If freq is passed, the index will be increased using the periods and the freq.

        Parameters
        ----------
        periods : int | Sequence[int], default 1
            Number of periods to shift. If a list of values, shift each group by
            each period.
        freq : str, optional
            Frequency string.
        fill_value : optional
            The scalar value to use for newly introduced missing values.

            .. versionchanged:: 2.1.0
                Will raise a ``ValueError`` if ``freq`` is provided too.

        suffix : str, optional
            A string to add to each shifted column if there are multiple periods.
            Ignored otherwise.

        Returns
        -------
        Series or DataFrame
            Object shifted within each group.

        See Also
        --------
        Index.shift : Shift values of Index.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([1, 2, 3, 4], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        b    4
        dtype: int64
        >>> ser.groupby(level=0).shift(1)
        a    NaN
        a    1.0
        b    NaN
        b    3.0
        dtype: float64

        For DataFrameGroupBy:

        >>> data = [[1, 2, 3], [1, 5, 6], [2, 5, 8], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data,
        ...     columns=["a", "b", "c"],
        ...     index=["tuna", "salmon", "catfish", "goldfish"],
        ... )
        >>> df
                   a  b  c
            tuna   1  2  3
          salmon   1  5  6
         catfish   2  5  8
        goldfish   2  6  9
        >>> df.groupby("a").shift(1)
                      b    c
            tuna    NaN  NaN
          salmon    2.0  3.0
         catfish    NaN  NaN
        goldfish    5.0  8.0
        r	   r   z0If `periods` is an iterable, it cannot be empty.r  TzPeriods must be integer, but z is ú.z/Cannot specify `suffix` if `periods` is an int.rð   FNc                ó,   •— | j                  ‰‰d‰«      S )Nr   )Úshift)r  Ú
fill_valueÚfreqÚperiods    €€€rj   r¹   zGroupBy.shift.<locals>.<lambda>‚  s   ø€ ˜aŸg™gØØØØó	€ rl   ©r  r�  )r  rÔ  r   r.  úSeries | DataFramer©   )r  r“   )r1   r   r®   rÏ   r  r  r/   rˆ  rú   r
  rÛ   r   Ú
no_defaultrœ   r  r¢   r¾   r  rÚ  r¹  Úgroup_shift_indexerrÚ   rÖ  r  r¬   rQ   r>  Ú
add_suffixrŽ  )rh   Úperiodsr  r  Úsuffixr  r  Úshifted_dataframesrs   Úshiftedr  r¢   Úres_indexerr‘   r  s     ``          @rj   r  zGroupBy.shift  s,  ú€ ô` ˜Ô Ü˜: wÓ/ˆGÜ�7‹|˜qÒ Ü Ð!SÓTÐTÝ9à‰Jä˜gÔ&ÜØ3°G°9¸DÄÀgÃÀÈqÐQóð ñ Ü Ð!RÓSÐSÜ˜E 7Ó+Ð,ˆGØˆJàÐØó &	KˆFÜ˜fÔ%ÜØ3°F°8¸4ÄÀVÃ¸~ÈQÐOóð ð Ðõ�ð ×4Ñ4Ø�t×)Ñ)¸ð 5ó ‘ð ¤§¡Ñ/Ø!%�JØ—m‘m×'Ñ'�ØŸ-™-×/Ñ/�Ü Ÿh™h¤s¨3£x´r·x±xÔ@�ä×.Ñ.¨{¸CÀÈ&ÔQà×/Ñ/�à×4Ñ4Ø˜Ÿ™ KÐ0Ð1Ø)Ø#ð 5ó �ñ Ü˜g¤vÔ.Ü" :¨w×/?Ñ/?Ó/AÓB�GØ!×,Ñ,Ù,2�v�h˜a ˜xÑ(¸!¸F¸8¸ó�ð ×%Ñ%¤dÐ+?ÀÓ&IÖJðM&	KôT Ð%Ó&¨!Ò+ð ˜qÑ!ð	
ñ Ð*°¸Ô?ð	
rl   c                ór  — | j                   }| j                  |¬«      }ddg}|j                  dk(  r$|j                  |v r|j	                  d«      }||z
  S |j
                  j                  «       D ��cg c]  \  }}||v sŒ|‘Œ }}}|r%|j	                  t        j                  |d«      «      }||z
  S c c}}w )aÐ  
        First discrete difference of element.

        Calculates the difference of each element compared with another
        element in the group (default is element in previous row).

        Parameters
        ----------
        periods : int, default 1
            Periods to shift for calculating difference, accepts negative values.

        Returns
        -------
        Series or DataFrame
            First differences.

        See Also
        --------
        Series.diff : Apply function diff to a Series.
        DataFrame.diff : Apply function diff to each row or column of a DataFrame.

        Examples
        --------
        For SeriesGroupBy:

        >>> lst = ["a", "a", "a", "b", "b", "b"]
        >>> ser = pd.Series([7, 2, 8, 4, 3, 3], index=lst)
        >>> ser
        a     7
        a     2
        a     8
        b     4
        b     3
        b     3
        dtype: int64
        >>> ser.groupby(level=0).diff()
        a    NaN
        a   -5.0
        a    6.0
        b    NaN
        b   -1.0
        b    0.0
        dtype: float64

        For DataFrameGroupBy:

        >>> data = {"a": [1, 3, 5, 7, 7, 8, 3], "b": [1, 4, 8, 4, 4, 2, 1]}
        >>> df = pd.DataFrame(
        ...     data, index=["dog", "dog", "dog", "mouse", "mouse", "mouse", "mouse"]
        ... )
        >>> df
                 a  b
          dog    1  1
          dog    3  4
          dog    5  8
        mouse    7  4
        mouse    7  4
        mouse    8  2
        mouse    3  1
        >>> df.groupby(level=0).diff()
                 a    b
          dog  NaN  NaN
          dog  2.0  3.0
          dog  2.0  4.0
        mouse  NaN  NaN
        mouse  0.0  0.0
        mouse  1.0 -2.0
        mouse -5.0 -1.0
        )r  Úint8Úint16r©   Úfloat32)	rÚ   r  r$  r‘  r–  ÚdtypesÚitemsÚdictÚfromkeys)rh   r  r‘   r  Údtypes_to_f32Úcr‘  Ú	to_coerces           rj   râ  zGroupBy.diffª  s¶   € ðT ×'Ñ'ˆØ—*‘* W�*Ó-ˆð   Ð)ˆØ�8‰8�qŠ=Ø�y‰y˜MÑ)Ø!Ÿ.™.¨Ó3�ð �W‰}Ðð	 ,/¯:©:×+;Ñ+;Ó+=×X™x˜q %ÀÈ-ÒAWšÐXˆIÑXÙØ!Ÿ.™.¬¯©°yÀ)Ó)LÓM�à�W‰}Ðùó	 Ys   Á3B3Â B3c                ó0  ‡‡— |�t        d|›d�«      ‚‰�$ˆˆfd„}| j                  || j                  d¬«      S | j                  d¬«      }|j	                  | j
                  j                  | j                  ¬«      }|j                  ‰‰¬	«      }||z  d
z
  S )aµ  
        Calculate pct_change of each value to previous entry in group.

        This method calculates the percentage change between the current and
        a prior element within each group, useful for computing growth rates.

        Parameters
        ----------
        periods : int, default 1
            Periods to shift for calculating percentage change. Comparing with
            a period of 1 means adjacent elements are compared, whereas a period
            of 2 compares every other element.

        fill_method : None
            Must be None. This argument will be removed in a future version of pandas.

        freq : str, pandas offset object, or None, default None
            The frequency increment for time series data (e.g., 'M' for month-end).
            If None, the frequency is inferred from the index. Relevant for time
            series data only.

        Returns
        -------
        Series or DataFrame
            Percentage changes within each group.

        See Also
        --------
        Series.pct_change : Apply function pct_change to a Series.
        DataFrame.pct_change : Apply function pct_change to each row or column of
            a DataFrame.

        Examples
        --------

        For SeriesGroupBy:

        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([1, 2, 3, 4], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        b    4
        dtype: int64
        >>> ser.groupby(level=0).pct_change()
        a         NaN
        a    1.000000
        b         NaN
        b    0.333333
        dtype: float64

        For DataFrameGroupBy:

        >>> data = [[1, 2, 3], [1, 5, 6], [2, 5, 8], [2, 6, 9]]
        >>> df = pd.DataFrame(
        ...     data,
        ...     columns=["a", "b", "c"],
        ...     index=["tuna", "salmon", "catfish", "goldfish"],
        ... )
        >>> df
                   a  b  c
            tuna   1  2  3
          salmon   1  5  6
         catfish   2  5  8
        goldfish   2  6  9
        >>> df.groupby("a").pct_change()
                    b  c
            tuna    NaN    NaN
          salmon    1.5  1.000
         catfish    NaN    NaN
        goldfish    0.2  0.125
        z*fill_method must be None; got fill_method=r	  c                ó,   •— | j                  ‰‰d¬«      S )Nr   )r  r  r  )Ú
pct_change)r  r  r  s    €€rj   r¹   z$GroupBy.pct_change.<locals>.<lambda>[  s   ø€ ˜!Ÿ,™,ØØØð 'ó € rl   Tr  r   r¿  )rš   )r  r  r©   )	rÏ   r
  rÛ   r¯  ri   rœ   Úcodesrš   r  )rh   r  Úfill_methodr  rs   ÚfilledÚfill_grpr  s    ` `    rj   r&  zGroupBy.pct_change  s¥   ù€ ðb Ð"ÜÐJ¸k¸^È1ÐMÓNÐNð ÐôˆAð
 ×-Ñ-¨a°×1CÑ1CÐRVÐ-ÓWÐWð —‘ !�Ó$ˆØ—>‘> $§-¡-×"5Ñ"5À$Ç/Á/�>ÓRˆØ—.‘.¨°t�.Ó<ˆØ˜Ñ  AÑ%Ð%rl   c                óZ   — | j                  t        d|«      «      }| j                  |«      S )a  
        Return first n rows of each group.

        Similar to ``.apply(lambda x: x.head(n))``, but it returns a subset of rows
        from the original DataFrame with original index and order preserved
        (``as_index`` flag is ignored).

        Parameters
        ----------
        n : int
            If positive: number of entries to include from start of each group.
            If negative: number of entries to exclude from end of each group.

        Returns
        -------
        Series or DataFrame
            Subset of original Series or DataFrame as determined by n.

        See Also
        --------
        Series.head : Apply function head to a Series.
        DataFrame.head : Apply function head to each row or column of a DataFrame.

        Examples
        --------

        >>> df = pd.DataFrame([[1, 2], [1, 4], [5, 6]], columns=["A", "B"])
        >>> df.groupby("A").head(1)
           A  B
        0  1  2
        2  5  6
        >>> df.groupby("A").head(-1)
           A  B
        0  1  2
        N©rÈ  ÚslicerÉ  ©rh   rÉ   r+  s      rj   ÚheadzGroupBy.headh  s,   € ðJ ×6Ñ6´u¸TÀ1³~ÓFˆØ×&Ñ& tÓ,Ð,rl   c                ó„   — |r| j                  t        | d«      «      }n| j                  g «      }| j                  |«      S )aI  
        Return last n rows of each group.

        Similar to ``.apply(lambda x: x.tail(n))``, but it returns a subset of rows
        from the original DataFrame with original index and order preserved
        (``as_index`` flag is ignored).

        Parameters
        ----------
        n : int
            If positive: number of entries to include from end of each group.
            If negative: number of entries to exclude from start of each group.

        Returns
        -------
        Series or DataFrame
            Subset of original Series or DataFrame as determined by n.

        See Also
        --------
        Series.tail : Apply function tail to a Series.
        DataFrame.tail : Apply function tail to each row or column of a DataFrame.

        Examples
        --------

        >>> df = pd.DataFrame(
        ...     [["a", 1], ["a", 2], ["b", 1], ["b", 2]], columns=["A", "B"]
        ... )
        >>> df.groupby("A").tail(1)
           A  B
        1  a  2
        3  b  2
        >>> df.groupby("A").tail(-1)
           A  B
        1  a  2
        3  b  2
        Nr,  r.  s      rj   ÚtailzGroupBy.tail�  sA   € ñP Ø×:Ñ:¼5À!ÀÀT»?ÓK‰Dà×:Ñ:¸2Ó>ˆDà×&Ñ& tÓ,Ð,rl   c                ó\   — | j                   j                  }||dk7  z  }| j                  |   S )a  
        Return _selected_obj with mask applied.

        Parameters
        ----------
        mask : np.ndarray[bool]
            Boolean mask to apply.

        Returns
        -------
        Series or DataFrame
            Filtered _selected_obj.
        r  )rœ   r  rÛ   )rh   r+  r  s      rj   rÉ  zGroupBy._mask_selected_obj¿  s2   € ð �m‰m×ÑˆØ�s˜b‘yÑ!ˆØ×!Ñ! $Ñ'Ð'rl   c                óx  — | j                   j                  r| j                   S t        j                  |||«      }|�"t        j                  | j                   |d¬«      }t        j                  |«      }| j                  j                  | j                   «      }g }	|D ]k  \  }
}| j                  |
   }t        |«      }|�|}n|€J ‚t        ||z  «      }t        j                  ||||€dn|   |¬«      }|	j                  ||   «       Œm t        j                  |	«      }| j                   j                  |d¬«      S )aœ  
        Return a random sample of items from each group.

        You can use `random_state` for reproducibility.

        Parameters
        ----------
        n : int, optional
            Number of items to return for each group. Cannot be used with
            `frac` and must be no larger than the smallest group unless
            `replace` is True. Default is one if `frac` is None.
        frac : float, optional
            Fraction of items to return. Cannot be used with `n`.
        replace : bool, default False
            Allow or disallow sampling of the same row more than once.
        weights : list-like, optional
            Default None results in equal probability weighting.
            If passed a list-like then values must have the same length as
            the underlying DataFrame or Series object and will be used as
            sampling probabilities after normalization within each group.
            Values must be non-negative with at least one positive element
            within each group.
        random_state : int, array-like, BitGenerator, np.random.RandomState, np.random.Generator, optional
            If int, array-like, or BitGenerator, seed for random number generator.
            If np.random.RandomState or np.random.Generator, use as given.
            Default ``None`` results in sampling with the current state of np.random.

        Returns
        -------
        Series or DataFrame
            A new object of same type as caller containing items randomly
            sampled within each group from the caller object.

        See Also
        --------
        DataFrame.sample: Generate random samples from a DataFrame object.
        Series.sample: Generate random samples from a Series object.
        numpy.random.choice: Generate a random sample from a given 1-D numpy
            array.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {"a": ["red"] * 2 + ["blue"] * 2 + ["black"] * 2, "b": range(6)}
        ... )
        >>> df
               a  b
        0    red  0
        1    red  1
        2   blue  2
        3   blue  3
        4  black  4
        5  black  5

        Select one row at random for each distinct value in column a. The
        `random_state` argument can be used to guarantee reproducibility:

        >>> df.groupby("a").sample(n=1, random_state=1)
               a  b
        4  black  4
        2   blue  2
        1    red  1

        Set `frac` to sample fixed proportions rather than counts:

        >>> df.groupby("a")["b"].sample(frac=0.5, random_state=2)
        5    5
        2    2
        0    0
        Name: b, dtype: int64

        Control sample probabilities within groups by setting weights:

        >>> df.groupby("a").sample(
        ...     n=1,
        ...     weights=[1, 1, 1, 0, 0, 1],
        ...     random_state=1,
        ... )
               a  b
        5  black  5
        2   blue  2
        0    red  0
        Nr   r  )r5  ÚreplaceÚweightsÚrandom_state)rÛ   rÝ  r;   Úprocess_sampling_sizeÚpreprocess_weightsrå   r6  rœ   rí   r´   r®   ÚroundrŽ  r¾   rÜ  r"  )rh   rÉ   Úfracr4  r5  r6  r5  Úweights_arrÚgroup_iteratorÚsampled_indicesr*  r‘   Úgrp_indicesÚ
group_sizeÚsample_sizeÚ
grp_sampleÚconcatenated_sampled_indicess                    rj   r;   zGroupBy.sampleÒ  s@  € ðx ×Ñ×#Ò#à×%Ñ%Ð%Ü×+Ñ+¨A¨t°WÓ=ˆØÐÜ ×3Ñ3°D×4FÑ4FÈÐVWÔXˆKä×'Ñ'¨Ó5ˆàŸ™×3Ñ3°D×4FÑ4FÓGˆàˆØ)ò 	<‰KˆF�CØŸ,™, vÑ.ˆKÜ˜[Ó)ˆJØÐØ"‘àÐ'Ð'Ð'Ü# D¨:Ñ$5Ó6�äŸ™ØØ ØØ ' ™°[ÀÑ5MØ)ôˆJð ×"Ñ" ;¨zÑ#:Õ;ð!	<ô$ (*§~¡~°oÓ'FÐ$Ø×!Ñ!×&Ñ&Ð'CÈ!Ð&ÓLÐLrl   c                ó|  — | j                   sàt        d„ | j                  j                  D «       «      rºt	        | j                  j
                  «      }| j                  j                  «       }||dkD     j                  d   }||k  sJ ‚||k  }| xr |}	| j                  }
|	r:t        |
t        «      r*|r|
j                  «       }
t	        |
j                  «      dkD  }	|	rIt        d|› d�«      ‚|s8| j                  j                  «       j                  d¬«      rt        |› d�«      ‚| j                  ||d|¬	«      }|S )
aÆ  Compute idxmax/idxmin.

        Parameters
        ----------
        how : {'idxmin', 'idxmax'}
            Whether to compute idxmin or idxmax.
        numeric_only : bool, default False
            Include only float, int, boolean columns.
        skipna : bool, default True
            Exclude NA/null values. If an entire group is NA, the result will be NA.
        ignore_unobserved : bool, default False
            When True and an unobserved group is encountered, do not raise. This used
            for transform where unobserved groups do not play an impact on the result.

        Returns
        -------
        Series or DataFrame
            idxmax or idxmin for the groupby operation.
        c              3  ó4   K  — | ]  }|j                   –— Œ y ­wrf   rè  rê  s     rj   rÆ   z)GroupBy._idxmax_idxmin.<locals>.<genexpr>i  s   è ø€ ò %
Ø)-ˆD×$Õ$ñ%
ùrì  r   z
Can't get zZ of an empty group due to unobserved categories. Specify observed=True in groupby instead.Nr  z+ with skipna=False encountered an NA value.r©   )r¡  r©  r¹  )r˜   r¤  rœ   r?  r®   r  r5  r“  rÚ   r¬   rE   Ú_get_numeric_datar:  rÏ   r7   rÁ  )rh   r™  Úignore_unobservedr¹  r¡  Úexpected_lenÚgroup_sizesÚ
result_lenÚhas_unobservedÚ	raise_errrQ  rî   s               rj   rÏ  zGroupBy._idxmax_idxminO  sN  € ð4 �}Š}¤ñ %
Ø15·±×1HÑ1Hô%
ô "
ô ˜tŸ}™}×9Ñ9Ó:ˆLàŸ-™-×,Ñ,Ó.ˆKØ$ [°1¡_Ñ5×;Ñ;¸AÑ>ˆJØ Ò-Ð-Ð-Ø'¨,Ñ6ˆNà->Ð)>Ò)QÀ>ˆIð ×,Ñ,ˆDÙœZ¨¬iÔ8ÙØ×1Ñ1Ó3�DÜ §¡Ó-°Ñ1�	áÜ Ø   ð &@ð @óð ñ ˜D×5Ñ5×:Ñ:Ó<×@Ñ@ÀdÐ@ÔKÜ ˜uÐ$OÐPÓQÐQà×)Ñ)ØØ%ØØð	 *ó 
ˆð ˆrl   c                óF  — | j                   j                  }|j                  dk(  r|j                  |j                  «      }|S |r/|j                  d«      j                  d ¬«      rt        |› d�«      ‚t        |t        «      r|j                  «       }|j                  }t        |t        j                  «      sJ ‚t        |j                  d¬«      }t        |t        «      rF|j!                  |j"                  j%                  |d|¬«      |j                  |j&                  ¬«      }|S i }t)        |j*                  «      D ]&  \  }	}
|j"                  j%                  |
d|¬«      ||	<   Œ( | j                   j!                  ||j                  ¬	«      }|j,                  |_        |S )
Nr   r  z7 with skipna=True encountered all NA values in a group.F)ÚcompatT)rÒ  r  rÓ  )r  )r‘   r  r5  r–  r‘  Últr¤  rÏ   r¬   rN   Úto_flat_indexr   r¾   r³  r8   rQ   rw  rÛ  r"  r‚   rB  r[   r:  )rh   r  r™  r¹  r  rî   r&  rR  rQ  ÚkÚcolumn_valuess              rj   r¾  zGroupBy._wrap_idxmax_idxmin�  sr  € ð —‘—‘ˆØ�8‰8�qŠ=Ø—Z‘Z §¡Ó,ˆFð4 ˆñ3 ˜Ÿ™˜q›	Ÿ™¨4˜Ô0ÜØ�%ÐNÐOóð ô ˜%¤Ô,Ø×+Ñ+Ó-�Ø—[‘[ˆFÜ˜f¤b§j¡jÔ1Ð1Ð1Ü)¨%¯+©+¸eÔDˆHÜ˜#œvÔ&à×)Ñ)Ø—K‘K×$Ñ$ V¸ÈÐ$ÓRØŸ)™)ØŸ™ð *ó �ð ˆð �Ü(1°&·(±(Ó(;ò Ñ$�A�}Ø#Ÿk™k×.Ñ.Ø%°$À8ð /ó �D˜’Gðð Ÿ™×.Ñ.¨t¸3¿9¹9Ð.ÓE�Ø!$§¡�”Øˆrl   )
NNNNNTTTTT)r‘   r   r’   r�   r”   rž   r–   úops.BaseGrouper | Noner™   zfrozenset[Hashable] | Nonerü   rž   r—   rŸ   r“   rŸ   rš   rŸ   r˜   rŸ   r•   rŸ   r‡   rˆ   )rƒ   rŠ   r‰   )FF)r  rŸ   r  rŸ   )rî   rö   r‡   rö   rf   )rî   r  rF  únpt.NDArray[np.float64] | Noner‡   rE   )rî   r  rF  rS  )r&  r­   r  rŸ   r  rŸ   )rQ  rE   )rà   r   ri  zdict[np.dtype, Any]rj  údict[str, bool] | None)r�  rŸ   r‡   r   )NF)
rs   r   rQ  rò   r  zbool | Noner  rŸ   r‡   r   )rs   r   r‡   r   )
r™  rŠ   r&  r   r$  rð   rš  r   r‡   r   )NFr  )r™  rŠ   rš  zCallable | Noner¡  rŸ   r©  rð   )F)r™  rŠ   r¡  rŸ   )rî   r   r‡   r   )T)rè  rŸ   r‡   z
np.ndarray)r‡   r   )r¹  rŸ   r‡   r   )r‡   r   )FTNN)r¡  rŸ   r¹  rŸ   rÅ  ú!Literal['cython', 'numba'] | Nonerj  rT  )FT)r¡  rŸ   r¹  rŸ   r‡   r   )r©   NNFT)
r  rð   rÅ  rU  rj  rT  r¡  rŸ   r¹  rŸ   )NFTFT)r>  zSequence[Hashable] | Noner?  rŸ   r“   rŸ   rè  rŸ   r•   rŸ   r‡   rò   )r©   FT)r  rð   r¡  rŸ   r¹  rŸ   r‡   r   rñ   )Fr   TNN)
r¡  rŸ   r©  rð   r¹  rŸ   rÅ  rU  rj  rT  )Fr   T)r¡  rŸ   r©  rð   r¹  rŸ   r‡   r   )Fr  TNN)Fr  T)r‡   rE   )NNN)NNNNÚ	start_dayNF)r–  úLiteral['right', 'left'] | Noner|   rW  r—  z(Literal['start', 'end', 's', 'e'] | Noner•  zLevel | Noner˜  zstr | TimestampConvertibleTypesr™  z TimedeltaConvertibleTypes | Nonerš   rŸ   r�  rŸ   r‡   r_   )NFNNNÚsingle)rž  z9int | datetime.timedelta | str | BaseOffset | BaseIndexerr  ú
int | NonerŸ  rŸ   r   ú
str | Noner•  rZ  r–  zIntervalClosedType | Noner  rŠ   r‡   rb   )r©   rX  )r  rð   r  rŠ   r‡   r`   )	NNNNr   TFNrX  )rå   úfloat | Noner§  r[  r¨  zfloat | str | Timedelta | Noner©  r[  r  rY  rª  rŸ   r«  rŸ   r¬  znp.ndarray | Series | Noner  rŠ   r‡   ra   )r»  zLiteral['ffill', 'bfill']r°  rY  )r°  rY  )r‡   rL   )rÉ   zPositionalIndexer | tupler•   zLiteral['any', 'all'] | Noner‡   r   )g      à?r×  F)râ  zfloat | AnyArrayLikerÒ  z;Literal['linear', 'lower', 'higher', 'nearest', 'midpoint']r¡  rŸ   )rè  rŸ   )ÚaverageTrö  F)
r  r!   rè  rŸ   rø  r"   rù  rŸ   r‡   r   )r  zint | Sequence[int]r  rZ  )r©   )r  rð   r‡   r   )r©   NN)r  rð   r(  rˆ   )é   )rÉ   rð   r‡   r   )r+  znpt.NDArray[np.bool_]r‡   r   )NNFNN)
rÉ   rY  r:  r[  r4  rŸ   r5  zListLike | Noner6  zRandomState | None)FTF)
r™  úLiteral['idxmax', 'idxmin']rF  rŸ   r¹  rŸ   r¡  rŸ   r‡   r   )r  r   r™  r^  r¹  rŸ   r‡   r   )Mrt   r‹   rŒ   r�   rô   r   rk   r…   r  r/  r  rI  rN  rR  ra  ro  r{  r€  rf  r
  ru   rž  rÁ  rÃ  rÍ  rÊ  rÐ  rß  rî  rõ   rñ  r¤  r¥  rê  r  r  r«  r&  rK  r¬  r5  r1  ra  r§  r¦  ru  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/  r1  rÉ  r;   rÏ  r¾  r„   rl   rj   r†   r†   ð  sÄ  … ñ@ðD ÓØƒNà
ð %)Ø#'Ø*.Ø15Ø'+ØØØØØð&Oàð&Oð "ð&Oð !ð	&Oð
 (ð&Oð /ð&Oð %ð&Oð ð&Oð ð&Oð ð&Oð ð&Oð ð&Oð 
ò&Oó ð&OóP
ð òó ððB ð "'Ø"ð	>?ð ð>?ð ò	>?ó ð>?ð@ ðØ)ðà	òó ðð2 àOSð/Ø(ð/Ø.Lð/à	ò/ó ð/ðb ð .2ð"à"ð"ð +ò"ó ð"ðP "'Ø"ð(ð ð(ð ð	(ð
 ó(ð ò
ó ð
ð4)àð)ð +ð)ð .ó	)ðV Ø?Có %Gó ð%GðN Ø?Có %ó ð%ðT 9>õ jHðX ð
 )-Ø"ð&
àð&
ð !ð&
ð &ð	&
ð
 ð&
ð 
ò&
ó ð&
ðP òNó ðNð&-9Øð-9Ø )ð-9Ø14ð-9Ø;Cð-9à	ó-9ð^ ð  $Ø"Øð><àð><ð ð><ð ð	><ð
 ò><ó ð><ô@(ð Ø-1Àó ó ðð< à"&°dó8ó ð8ð* òó ðð: ñó ðð  ó$ó ð$ðP Øò%ó ó ð%ð ó<
ó ð<
ð| ó=
ó ð=
ð~ ògó ðgðR ð #ØØ48Ø04ðgàðgð ðgð 2ð	gð
 .ògó ðgðR ó`
ó ð`
ðD ð Ø48Ø04Ø"Øðvàðvð 2ðvð .ð	vð
 ðvð òvó ðvðp ð Ø48Ø04Ø"Øðnàðnð 2ðnð .ð	nð
 ðnð ònó ðnð` ð -1ØØØØðzDà)ðzDð ðzDð ð	zDð
 ðzDð ðzDð 
òzDó ðzDðx àHLðg
Øðg
Ø+/ðg
ØAEðg
à	òg
ó ðg
ðR ò\ó ð\ð| ð #ØØØ48Ø04ðuàðuð ðuð ð	uð
 2ðuð .òuó ðuðn àMQðU
Ø ðU
Ø58ðU
ØFJðU
à	òU
ó ðU
ðn ð #ØØØ48Ø04ðyàðyð ðyð ð	yð
 2ðyð .òyó ðyðv ð #ØØØ48Ø04ðwàðwð ðwð ð	wð
 2ðwð .òwó ðwðr àNRðT
Ø ðT
Ø58ðT
ØGKðT
à	òT
ó ðT
ðl àNRðC
Ø ðC
Ø58ðC
ØGKðC
à	òC
ó ðC
ðJ òqó ðqðj ØØð	!ð
 
ó!ðF ð 37Ø15Ø?CØØ2=Ø37Ø ð[
ð  %ñ[
ð 0ð[
ð /ð	[
ð
 =ð[
ð ð[
ð 0ð[
ð 1ð[
ð ð[
ð ð[
ð 
ò[
ó ð[
ðz ð #'ØØ#ØØ,0Øðf
àIðf
ð  ðf
ð ð	f
ð
 ðf
ð ðf
ð *ðf
ð ðf
ð 
òf
ó ðf
ðP ð ØðF
àðF
ð ðF
ð 
ò	F
ó ðF
ðP ð !Ø!Ø37Ø"Ø"#ØØØ,0Øðj
àðj
ð ðj
ð 1ð	j
ð
 ðj
ð  ðj
ð ðj
ð ðj
ð *ðj
ð ðj
ð 
(òj
ó ðj
ðX óIó ðIðV ó\0ó ð\0ð| óQ0ó ðQ0ðf ØòE(ó ó ðE(ðT 04ð5à$ð5ð -ð5ð 
ó	5ðn ð #&ð Ø"ðS=àðS=ð
ðS=ð òS=ó ðS=ðj óPó ðPðd ó6:ó ð6:ðp ð 'ØØ"(ØðZ
àðZ
ð ðZ
ð  ð	Z
ð
 ðZ
ð 
òZ
ó ðZ
ðx ð #ØðXNàðXNð ðXNð 
òXNó ðXNðt ð #ØðXMàðXMð ðXMð 
òXMó ðXMðt ð #ØðW
àðW
ð ðW
ð
 
òW
ó ðW
ðr ð #ØðX
àðX
ð ðX
ð
 
òX
ó ðX
ðt ð ()ØØ—>‘>Ø!ðM
à$ðM
ð
 òM
ó ðM
ð^ ð ðWàðWð 
òWó ðWðr ð Ø Øð	a&àða&ð òa&ó ða&ðF ó%-ó ð%-ðN ó,-ó ð,-ð\ ò(ó ð(ð$ ð Ø!ØØ#'Ø+/ðzMàðzMð ðzMð ð	zMð
 !ðzMð )òzMó ðzMð~ #(ØØ"ð<à(ð<ð  ð<ð ð	<ð
 ð<ð 
ó<ð|ØðØ"=ðØGKðà	ôrl   r†   c                ó¦   — t        | t        «      rddlm}  || |||¬«      S t        | t        «      rddlm}  || |||¬«      S t        d| › �«      ‚)am  
    Class for grouping and aggregating relational data.

    See aggregate, transform, and apply functions on this object.

    It's easiest to use obj.groupby(...) to use GroupBy, but you can also do:

    ::

        grouped = groupby(obj, ...)

    Parameters
    ----------
    obj : pandas object

    Returns
    -------
    **Attributes**
    groups : dict
        {group name -> group labels}
    len(grouped) : int
        Number of groups

    Notes
    -----
    After grouping, see aggregate, apply, and transform functions. Here are
    some other brief notes about usage. When grouping by multiple groups, the
    result index will be a MultiIndex (hierarchical) by default.

    Iteration produces (key, group) tuples, i.e. chunking the data by group. So
    you can write code like:

    ::

        grouped = obj.groupby(keys)
        for key, group in grouped:
            # do something with the data

    Function calls on GroupBy, if not specially implemented, "dispatch" to the
    grouped data. So if you group a DataFrame and wish to invoke the std()
    method on each group, you can simply do:

    ::

        df.groupby(mapper).std()

    rather than

    ::

        df.groupby(mapper).aggregate(np.std)

    You can pass arguments to these "wrapped" functions, too.

    See the online documentation for full exposition on these topics and much
    more
    r   )ÚSeriesGroupBy)r‘   r’   r–   rš   )ÚDataFrameGroupByzinvalid type: )r¬   rQ   Úpandas.core.groupby.genericr`  rE   ra  rˆ  )r‘   Úbyr–   rš   r`  ra  s         rj   Úget_groupbyrd  ¯  sg   € ô~ �#”vÔÝ=áØØØØ!ô	
ð 	
ô 
�CœÔ	#Ý@áØØØØ!ô	
ð 	
ô ˜.¨¨Ð.Ó/Ð/rl   c                óŒ  — t        |«      }t        |d¬«      j                  «       \  }}t        ||«      }| j                  r‰t        d| «      } g | j                  ¢|‘}| j                  D �cg c]  }t        j                  ||«      ‘Œ c}t        j                  |t        | «      «      gz   }t        ||g | j                  ¢d‘¬«      }|S t        | «      }	t        t        j                  |	«      | «      }
| |g}t        j                  |
|«      t        j                  ||	«      g}t        ||| j                  dg¬«      }|S c c}w )a  
    Insert the sequence 'qs' of quantiles as the inner-most level of a MultiIndex.

    The quantile level in the MultiIndex is a repeated copy of 'qs'.

    Parameters
    ----------
    idx : Index
    qs : np.ndarray[float64]

    Returns
    -------
    MultiIndex
    Fr1  rN   N)r  r'  r  )r®   rM   Ú	factorizer*   Ú	_is_multir   r  r'  r¾   rE  rA  rN   r  rç  r‚   )r+  rF  rÝ  Ú	lev_codesrH  r  r  r'  ÚmiÚnidxÚ	idx_codess              rj   rM  rM    s  € ô ˆb‹'€CÜ˜2 EÔ*×4Ñ4Ó6�N€IˆsÜ$ Y°Ó4€Ià
‡}‚}Ü�< Ó%ˆØ#�3—:‘:Ð#˜sÐ#ˆØ,/¯I©IÖ6 q”—‘˜1˜cÕ"Ò6¼"¿'¹'À)ÌSÐQTËXÓ:VÐ9WÑWˆÜ˜v¨UÐ:L¸C¿I¹IÐ:LÀtÐ:LÔMˆð €Iô �3‹xˆÜ(¬¯©°4«¸#Ó>ˆ	Ø�s�ˆÜ—‘˜9 cÓ*¬B¯G©G°I¸tÓ,DÐEˆÜ˜v¨U¸3¿8¹8ÀTÐ:JÔKˆà€Iùò 7s   Á,E)NNT)
r‘   rF   rc  r�   r–   rR  rš   rŸ   r‡   r†   )r+  rM   rF  znpt.NDArray[np.float64]r‡   rN   )›r�   Ú
__future__r   Úcollections.abcr   r   r   r   r   r	   r½   Ú	functoolsr
   r   Útypingr   r   r   r   r   r   r   r   r   r¯   Únumpyr¾   Úpandas._libsr   r   Úpandas._libs.algosr   Úpandas._libs.groupbyÚ_libsri   r¹  Úpandas._libs.missingr   Úpandas._typingr   r   r   r   r   r   r   r    r!   r"   r#   Úpandas.compat.numpyr$   rþ  Úpandas.errorsr%   r&   r'   Úpandas.util._decoratorsr(   Úpandas.util._exceptionsr)   Úpandas.core.dtypes.castr*   r+   Úpandas.core.dtypes.commonr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   Úpandas.core.dtypes.missingr7   r8   r9   Úpandas.corer:   r;   Úpandas.core._numbar<   Úpandas.core.arraysr=   r>   r?   r@   Úpandas.core.arrays.string_rA   Úpandas.core.arrays.string_arrowrB   Úpandas.core.baserC   rD   Úpandas.core.commonÚcoreÚcommonrå   Úpandas.core.framerE   Úpandas.core.genericrF   Úpandas.core.groupbyrG   rH   rI   Úpandas.core.groupby.grouperrJ   Úpandas.core.groupby.indexingrK   rL   Úpandas.core.indexes.apirM   rN   rO   Úpandas.core.internals.blocksrP   Úpandas.core.seriesrQ   Úpandas.core.sortingrR   Úpandas.core.util.numba_rS   rT   rU   Úpandas._libs.tslibsrV   Úpandas._libs.tslibs.timedeltasrW   rX   rY   rZ   r[   r\   r]   Úpandas.core.indexers.objectsr^   rš  r_   r¢  r`   ra   rb   rd   r­   rŽ   rô   r�   rö   r†   rd  rM  r„   rl   rj   ú<module>r”     s*  ðòõ #÷÷ ó ÷÷
÷ 
õ 
ó ã ÷õ 'ß )Ð )Ý #÷÷ ÷ ñ õ /÷ñ õ
 3Ý 4÷÷÷ ÷ ñ ÷ñ ÷õ (÷ó õ 3Ý <÷÷ !Ð  Ý 'Ý '÷ñ õ
 4÷÷ñ õ
 <Ý %Ý 6÷ñ ñ Ý.Ý8÷÷ õ 9Ý.÷ñ ð ô�,ó ó ðð@ Ø
ˆ8�nñà�ˆz˜8Ð#Ñ$ñ%ð ˆ8�X�J Ð(Ñ)Ñ*ñ+ð ˆh˜Ð Ñ!ñ	"ð ˆió ôc�, ¨xÑ 8Ð:Nô cñN Ð3¸7ÔCÐ ô|Nˆk˜(Ñ#ô |NðB^ #Ø&*Øð	R0Ø	ðR0àðR0ð $ðR0ð ð	R0ð
 óR0ôjrl   