
    Pi                    2   U d Z ddlmZ ddlmZ ddlmZ ddlZd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ZddlZdd	lmZ dd
lmZ ddlmZmZ ddlmZ ddlm Z  ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( ddl)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5m6Z6m7Z7 ddl8m9c m:Z; ddl<m=Z= ddl>m?Z? ddl@mAZAmBZB ddlCmDZDmEZEmFZFmGZG ddlHmIZI ddlJmKZK ddlLmMZM ddlNmOZO er&ddlmPZPmQZQ ddlRmSZSmTZTmUZUmVZVmWZWmXZXmYZY ddlZm[Z[ ddl\m]Z] e^ed ef         z  Z_d!e`d"<    ed#          Za ed$          ejb         G d% d&                                  Zc ed'           G d( d)eAeI                               Zd ed'           G d* d+eAe=                               Zed3d2ZfdS )4z
Define the SeriesGroupBy and DataFrameGroupBy
classes that hold the groupby interfaces (and some implementations).

These are user facing as the result of the ``df.groupby(...)`` operations,
which here returns a DataFrameGroupBy object.
    )annotations)abc)CallableN)partial)dedent)TYPE_CHECKINGAnyLiteral	TypeAliasTypeVarcast)Interval)
duplicated)Pandas4WarningSpecificationError)
set_module)find_stack_level)ensure_int64is_boolis_dict_likeis_integer_dtypeis_list_likeis_numeric_dtype	is_scalar)CategoricalDtypeIntervalDtype)is_hashable)isnanotna)
algorithms)GroupByApplymaybe_mangle_lambdasreconstruct_funcvalidate_func_kwargs)	DataFrame)base)GroupByGroupByPlot)Index
MultiIndexall_indexes_samedefault_index)Series)get_group_index)maybe_use_numba)boxplot_frame_groupby)HashableSequence)	ArrayLikeBlockManagerCorrelationMethod
IndexLabelManagerSingleBlockManagerTakeIndexer)Categorical)NDFrame.r   	AggScalarScalarResultpandasc                  r    e Zd ZU dZded<   ded<   dZded<    ej        e	          Z	d
ed<   ddZ
ddZdS )NamedAgga  
    Helper for column specific aggregation with control over output column names.

    Parameters
    ----------
    column : Hashable
        Column label in the DataFrame to apply aggfunc.
    aggfunc : function or str
        Function to apply to the provided column. If string, the name of a built-in
        pandas function.
    *args, **kwargs : Any
        Optional positional and keyword arguments passed to ``aggfunc``.

    See Also
    --------
    DataFrame.groupby : Group DataFrame using a mapper or by a Series of columns.

    Examples
    --------
    >>> df = pd.DataFrame({"key": [1, 1, 2], "a": [-1, 0, 1], 1: [10, 11, 12]})
    >>> agg_a = pd.NamedAgg(column="a", aggfunc="min")
    >>> agg_1 = pd.NamedAgg(column=1, aggfunc=lambda x: np.mean(x))
    >>> df.groupby("key").agg(result_a=agg_a, result_1=agg_1)
        result_a  result_1
    key
    1          -1      10.5
    2           1      12.0

    >>> def n_between(ser, low, high, **kwargs):
    ...     return ser.between(low, high, **kwargs).sum()

    >>> agg_between = pd.NamedAgg("a", n_between, 0, 1)
    >>> df.groupby("key").agg(count_between=agg_between)
        count_between
    key
    1               1
    2               1

    >>> agg_between_kw = pd.NamedAgg("a", n_between, 0, 1, inclusive="both")
    >>> df.groupby("key").agg(count_between_kw=agg_between_kw)
        count_between_kw
    key
    1                   1
    2                   1
    r1   columnr<   aggfunc ztuple[Any, ...]args)default_factoryzdict[str, Any]kwargsCallable[..., Any] | strr	   returnNonec                >    || _         || _        || _        || _        d S N)rA   rB   rD   rF   )selfrA   rB   rD   rF   s        o/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pandas/core/groupby/generic.py__init__zNamedAgg.__init__   s$     	    keyintc                    |dk    r| j         S |dk    r| j        S |dk    r| j        S |dk    r| j        S t	          d          )z/Provide backward-compatible tuple-style access.r            zindex out of range)rA   rB   rD   rF   
IndexError)rL   rP   s     rM   __getitem__zNamedAgg.__getitem__   sU    !88;AXX<AXX9AXX;-...rO   N)
rA   r1   rB   rG   rD   r	   rF   r	   rH   rI   )rP   rQ   rH   r	   )__name__
__module____qualname____doc____annotations__rD   dataclassesfielddictrF   rN   rW   rC   rO   rM   r@   r@   m   s         , ,\ D.[.tDDDFDDDD
 
 
 

/ 
/ 
/ 
/ 
/ 
/rO   r@   zpandas.api.typingc                      e Zd Zd\dZdddd]dZd^ fdZd_ddddZeZd Zd`dZ		 	 dadbdZ
 ed          ZddddZdcddd Zded#Zdfdgd&Zdfdhd(Zdid^ fd)Z	 	 	 	 	 djdkd-Zdld0Z	 	 dmdnd2Z	 	 dmdnd3Zedod5            Z	 dpdqd<Z	 dpdqd=Zdfdrd>Zdfdrd?Z	 	 dsdtdFZ	 dudvdIZed^dJ            Zed^dK            Z 	 	 	 	 	 	 	 	 	 	 	 dwdxdYZ!ed^dZ            Z"d^d[Z# xZ$S )ySeriesGroupBymgrr7   rH   r-   c                j    | j                             ||j                  }| j         j        |_        |S Naxes)obj_constructor_from_mgrrf   name_name)rL   rb   outs      rM   _wrap_agged_managerz!SeriesGroupBy._wrap_agged_manager   s.    h,,Ssx,@@HM	
rO   FNnumeric_onlyri   rn   boolri   
str | Noner8   c          	         | j         }|j        }|rAt          |j                  s-d}t	          d| dt          |           j         d| d          |S )Nrn   zCannot use z=True with .z and non-numeric dtypes.)_obj_with_exclusions_mgrr   dtype	TypeErrortyperX   )rL   rn   ri   sersinglekwd_names         rM   _get_data_to_aggregatez$SeriesGroupBy._get_data_to_aggregate   s     ' 	 0 ; ; 	%HHh H H::&H H)-H H H   rO   c                >     t                      j        |g|R i |S )aC  
        Apply function ``func`` group-wise and combine the results together.

        The function passed to ``apply`` must take a series 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 series 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``.

        **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
        -----
        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.

        Examples
        --------
        >>> s = pd.Series([0, 1, 2], index="a a b".split())
        >>> g1 = s.groupby(s.index, group_keys=False)
        >>> g2 = s.groupby(s.index, group_keys=True)

        From ``s`` above we can see that ``g`` has two groups, ``a`` and ``b``.
        Notice that ``g1`` have ``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: The function passed to `apply` takes a Series as
        its argument and returns a Series.  `apply` combines the result for
        each group together into a new Series.

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

        >>> g1.apply(lambda x: x * 2 if x.name == "a" else x / 2)
        a    0.0
        a    2.0
        b    1.0
        dtype: float64

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

        >>> g2.apply(lambda x: x * 2 if x.name == "a" else x / 2)
        a  a    0.0
           a    2.0
        b  b    1.0
        dtype: float64

        Example 2: The function passed to `apply` takes a Series 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.max() - x.min())
        a    1
        b    0
        dtype: int64

        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.

        >>> g2.apply(lambda x: x.max() - x.min())
        a    1
        b    0
        dtype: int64
        )superapply)rL   funcrD   rF   	__class__s       rM   r~   zSeriesGroupBy.apply   s,    N uww}T3D333F333rO   engineengine_kwargsc                  |du }d}|rt          |          \  }}i }t          |t                    r3t          |          r|||d<   |||d<    t	          | |          |i |S t          |t
          j                  rTt          |          }||d<   ||d<    | j        |g|R i |}|r|J ||_	        | j
        s|                                }|S t          |          r | j        |g|R d|i|S | j        dk    rQ| j        }	|                     | j                            g | j        j        | j        j        |	j                            S  | j        |g|R i |S )a|  
        Aggregate using one or more operations.

        The ``aggregate`` method enables flexible and efficient aggregation of grouped
        data using a variety of functions, including built-in, user-defined, and
        optimized JIT-compiled functions.

        Parameters
        ----------
        func : function, str, list or None
            Function to use for aggregating the data. If a function, must either
            work when passed a Series or when passed to Series.apply.

            Accepted combinations are:

            - function
            - string function name
            - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
            - None, in which case ``**kwargs`` are used with Named Aggregation. Here
              the output has one column for each element in ``**kwargs``. The name of
              the column is keyword, whereas the value determines the aggregation
              used to compute the values in the column.

              Can also accept a Numba JIT function with
              ``engine='numba'`` specified. Only passing a single function is supported
              with this engine.

              If the ``'numba'`` engine is chosen, the function must be
              a user defined function with ``values`` and ``index`` as the
              first and second arguments respectively in the function signature.
              Each group's index will be passed to the user defined function
              and optionally available for use.

        *args
            Positional arguments to pass to func.
        engine : str, default None
            * ``'cython'`` : Runs the function through C-extensions from cython.
            * ``'numba'`` : Runs the function 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 ``nopython``, ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nopython': True, 'nogil': False, 'parallel': False}`` and will be
              applied to the function

        **kwargs
            * If ``func`` is None, ``**kwargs`` are used to define the output names and
              aggregations via Named Aggregation. See ``func`` entry.
            * Otherwise, keyword arguments to be passed into func.

        Returns
        -------
        Series
            Aggregated Series based on the grouping and the applied aggregation
            functions.

        See Also
        --------
        SeriesGroupBy.apply : Apply function func group-wise
            and combine the results together.
        SeriesGroupBy.transform : Transforms the Series on each group
            based on the given function.
        Series.aggregate : Aggregate using one or more operations.

        Notes
        -----
        When using ``engine='numba'``, there will be no "fall back" behavior internally.
        The group data and group index will be passed as numpy arrays to the JITed
        user defined function, and no alternative execution attempts will be tried.

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

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

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4])

        >>> s
        0    1
        1    2
        2    3
        3    4
        dtype: int64

        >>> s.groupby([1, 1, 2, 2]).min()
        1    1
        2    3
        dtype: int64

        >>> s.groupby([1, 1, 2, 2]).agg("min")
        1    1
        2    3
        dtype: int64

        >>> s.groupby([1, 1, 2, 2]).agg(["min", "max"])
           min  max
        1    1    2
        2    3    4

        The output column names can be controlled by passing
        the desired column names and aggregations as keyword arguments.

        >>> s.groupby([1, 1, 2, 2]).agg(
        ...     minimum="min",
        ...     maximum="max",
        ... )
           minimum  maximum
        1        1        2
        2        3        4

        The resulting dtype will reflect the return value of the aggregating
        function.

        >>> s.groupby([1, 1, 2, 2]).agg(lambda x: x.astype(float).min())
        1    1.0
        2    3.0
        dtype: float64
        Nr   r   r   ri   indexru   )r$   
isinstancestrr/   getattrr   Iterabler"   _aggregate_multiple_funcscolumnsas_indexreset_index_aggregate_with_numbangroupsrs   _wrap_aggregated_outputrg   _constructorri   _grouperresult_indexru   _python_agg_general)
rL   r   r   r   rD   rF   
relabelingr   retrg   s
             rM   	aggregatezSeriesGroupBy.aggregate:  s   ~ T\
 	088MGTFdC   .	Cv&& *6+=
 $*x (*7'&74&&7777cl++ #	C (--D%F8&3F?#0$0GGGGGGC &***%= (oo''J v&& 1t1  /<@F   |q  
 /33H))!X]"m8!i	 *     ,4+DB4BBB6BBBrO   c                    fd}| j         }| j                            ||          }|                    ||j                  }|                     |          S )Nc                     | gR i S rK   rC   xrD   r   rF   s    rM   <lambda>z3SeriesGroupBy._python_agg_general.<locals>.<lambda>  !    dd1.t...v.. rO   ri   )rs   r   
agg_seriesr   ri   r   )rL   r   rD   rF   frg   resultress    ```    rM   r   z!SeriesGroupBy._python_agg_general  sf    ......'))#q11vCH55++C000rO   r%   c                &   t          |t                    rt          d          t          d |D                       rd |D             }nd |D             }t	          ||d          }i }t          j        | dd          5  t          |          D ]2\  }\  }}t          j	        ||          }	 | j
        |g|R i |||	<   3	 d d d            n# 1 swxY w Y   t          d	 |                                D                       r2d
dlm}
  |
|                                dd |D                       }|S d |                                D             }| j                            |d           }t#          d |D                       |_        |S )Nznested renamer is not supportedc              3  N   K   | ] }t          |t          t          f          V  !d S rK   r   tuplelist.0r   s     rM   	<genexpr>z:SeriesGroupBy._aggregate_multiple_funcs.<locals>.<genexpr>  s0      99z!eT]++999999rO   c              3  Z   K   | ]&}t          |t          t          f          s||fn|V  'd S rK   r   r   s     rM   r   z:SeriesGroupBy._aggregate_multiple_funcs.<locals>.<genexpr>  s=      RRAt}!=!=DAq661RRRRRRrO   c              3  B   K   | ]}t          j        |          p|V  d S rK   )comget_callable_name)r   r   s     rM   r   z:SeriesGroupBy._aggregate_multiple_funcs.<locals>.<genexpr>  s2      BBs,Q//41BBBBBBrO   T)strictr   )labelpositionc              3  @   K   | ]}t          |t                    V  d S rK   )r   r%   r   s     rM   r   z:SeriesGroupBy._aggregate_multiple_funcs.<locals>.<genexpr>  s,      BBAz!Y''BBBBBBrO   r   concatrS   c                    g | ]	}|j         
S rC   r   r   rP   s     rM   
<listcomp>z;SeriesGroupBy._aggregate_multiple_funcs.<locals>.<listcomp>  s    /M/M/Mc	/M/M/MrO   )axiskeysc                $    i | ]\  }}|j         |S rC   )r   )r   rP   vals      rM   
<dictcomp>z;SeriesGroupBy._aggregate_multiple_funcs.<locals>.<dictcomp>  s     LLLS#,LLLrO   r   c              3  $   K   | ]}|j         V  d S rK   r   r   s     rM   r   z:SeriesGroupBy._aggregate_multiple_funcs.<locals>.<genexpr>  s$      <<Ssy<<<<<<rO   )r   r_   r   anyzipr   temp_setattr	enumerater&   	OutputKeyr   valuesr>   r   itemsrg   _constructor_expanddimr)   r   )rL   argrD   rF   r   resultsidxri   r   rP   r   res_dfindexed_outputoutputs                 rM   r   z'SeriesGroupBy._aggregate_multiple_funcs  s7   c4   	H$%FGGG99S99999 	1RRcRRRCC CBcBBBGgs4000C<>dJ55 	E 	E &/s^^ E E!\dDn4#>>>-t~dDTDDDVDDE	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E BB1A1ABBBBB 	%%%%%%V  q/M/MW/M/M/M  F MLLGMMOOLLL00t0LL<<G<<<<<s   ACCCdatar   	list[Any]not_indexed_sameis_transformDataFrame | Seriesc                (   t          |          dk    rM|r|j        }n| j        sd}n| j        j        }| j                            g | j        j        ||j                  S |J t          |d         t                    rO| j        j        }| j                            ||          }|                                }| j        j        |_        |S t          |d         t          t          f          r|                     |||          }	t          |	t                    r| j        j        |	_        | j        s8|r6|                     |	          }	t%          t          |	                    |	_        |	                    | j        d          S | j                            || j        j        | j        j                  }	| j        s6|                     |	          }	t%          t          |	                    |	_        |	                    | j        d          S )	a  
        Wrap the output of SeriesGroupBy.apply into the expected result.

        Parameters
        ----------
        data : Series
            Input data for groupby operation.
        values : List[Any]
            Applied output for each group.
        not_indexed_same : bool, default False
            Whether the applied outputs are not indexed the same as the group axes.

        Returns
        -------
        DataFrame or Series
        r   Nr   r   r   r   groupbymethod)r   r   ri   )lenr   
group_keysr   r   rg   r   ri   ru   r   r_   r   stackr-   r%   _concat_objectsr   _insert_inaxis_grouperr,   __finalize__)
rL   r   r   r   r   	res_indexr   r   res_serr   s
             rM   _wrap_applied_outputz"SeriesGroupBy._wrap_applied_output  s
   . v;;! 7 J		_ 7 		 M6	8((X]j	 )    !!!fQi&& 	CM.EX44V54IIF llnnG8=GLNq	FI#677 	C))!1) *  F
 &&)) ,"hm= :%5 :44V<<,S[[99&&tx	&BBB X**4=#=DHM +  F = :44V<<,S[[99&&tx	&BBBrO   a  
    >>> ser = pd.Series([390.0, 350.0, 30.0, 20.0],
    ...                 index=["Falcon", "Falcon", "Parrot", "Parrot"],
    ...                 name="Max Speed")
    >>> grouped = ser.groupby([1, 1, 2, 2])
    >>> grouped.transform(lambda x: (x - x.mean()) / x.std())
        Falcon    0.707107
        Falcon   -0.707107
        Parrot    0.707107
        Parrot   -0.707107
        Name: Max Speed, dtype: float64

    Broadcast result of the transformation

    >>> grouped.transform(lambda x: x.max() - x.min())
    Falcon    40.0
    Falcon    40.0
    Parrot    10.0
    Parrot    10.0
    Name: Max Speed, dtype: float64

    >>> grouped.transform("mean")
    Falcon    370.0
    Falcon    370.0
    Parrot     25.0
    Parrot     25.0
    Name: Max Speed, dtype: float64

    The resulting dtype will reflect the return value of the passed ``func``,
    for example:

    >>> grouped.transform(lambda x: x.astype(int).max())
    Falcon    390
    Falcon    390
    Parrot     30
    Parrot     30
    Name: Max Speed, dtype: int64
    c               *     | j         |g|R ||d|S )a  
        Call function producing a same-indexed Series on each group.

        Returns a Series having the same indexes as the original object
        filled with the transformed values.

        Parameters
        ----------
        func : function, str
            Function to apply to each group.
            See the Notes section below for requirements.

            Accepted inputs are:

            - String
            - Python function
            - Numba JIT function with ``engine='numba'`` specified.

            Only passing a single function is supported with this engine.
            If the ``'numba'`` engine is chosen, the function must be
            a user defined function with ``values`` and ``index`` as the
            first and second arguments respectively in the function signature.
            Each group's index will be passed to the user defined function
            and optionally available for use.

            If a string is chosen, then it needs to be the name
            of the groupby method you want to use.
        *args
            Positional arguments to pass to func.
        engine : str, default None
            * ``'cython'`` : Runs the function through C-extensions from cython.
            * ``'numba'`` : Runs the function through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'``
              or the global 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 ``nopython``, ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nopython': True, 'nogil': False, 'parallel': False}`` and will be
              applied to the function

        **kwargs
            Keyword arguments to be passed into func.

        Returns
        -------
        Series
            Series with the same indexes as the original object filled
            with transformed values.

        See Also
        --------
        Series.groupby.apply : Apply function ``func`` group-wise and combine
            the results together.
        Series.groupby.aggregate : Aggregate using one or more operations.
        Series.transform : Call ``func`` on self producing a Series with the
            same axis shape as self.

        Notes
        -----
        Each group is endowed the attribute 'name' in case you need to know
        which group you are working on.

        The current implementation imposes three requirements on f:

        * f must return a value that either has the same shape as the input
          subframe or can be broadcast to the shape of the input subframe.
          For example, if `f` returns a scalar it will be broadcast to have the
          same shape as the input subframe.
        * if this is a DataFrame, f must support application column-by-column
          in the subframe. If f also supports application to the entire subframe,
          then a fast path is used starting from the second chunk.
        * f must not mutate groups. Mutation is not supported and may
          produce unexpected results. See :ref:`gotchas.udf-mutation` for more details.

        When using ``engine='numba'``, there will be no "fall back" behavior internally.
        The group data and group index will be passed as numpy arrays to the JITed
        user defined function, and no alternative execution attempts will be tried.

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

        .. versionchanged:: 2.0.0

            When using ``.transform`` on a grouped DataFrame and
            the transformation function returns a DataFrame,
            pandas now aligns the result's index with the input's index.
            You can call ``.to_numpy()`` on the result of
            the transformation function to avoid alignment.

        Examples
        --------

        >>> ser = pd.Series(
        ...     [390.0, 350.0, 30.0, 20.0],
        ...     index=["Falcon", "Falcon", "Parrot", "Parrot"],
        ...     name="Max Speed",
        ... )
        >>> grouped = ser.groupby([1, 1, 2, 2])
        >>> grouped.transform(lambda x: (x - x.mean()) / x.std())
            Falcon    0.707107
            Falcon   -0.707107
            Parrot    0.707107
            Parrot   -0.707107
            Name: Max Speed, dtype: float64

        Broadcast result of the transformation

        >>> grouped.transform(lambda x: x.max() - x.min())
        Falcon    40.0
        Falcon    40.0
        Parrot    10.0
        Parrot    10.0
        Name: Max Speed, dtype: float64

        >>> grouped.transform("mean")
        Falcon    370.0
        Falcon    370.0
        Parrot     25.0
        Parrot     25.0
        Name: Max Speed, dtype: float64

        The resulting dtype will reflect the return value of the passed ``func``,
        for example:

        >>> grouped.transform(lambda x: x.astype(int).max())
        Falcon    390
        Falcon    390
        Parrot     30
        Parrot     30
        Name: Max Speed, dtype: int64
        r   
_transformrL   r   r   r   rD   rF   s         rM   	transformzSeriesGroupBy.transform  sB    N t

 
 &m
 
GM
 
 	
rO   howr   c                    | j         }	  | j        j        d|j        |dfi |}n-# t          $ r }t          | d|j         d          |d }~ww xY w|                    || j        j	        |j
                  S )Nr   r   z is not supported for z dtyper   ri   )rs   r   _cython_operation_valuesNotImplementedErrorrv   ru   r   rg   r   ri   )rL   r   rn   rF   rg   r   errs          rM   _cython_transformzSeriesGroupBy._cython_transform  s    '	V4T]4S[#q 4: FF # 	V 	V 	VsKK#)KKKLLRUU	V dhn38LLLs   % 
AA

Ar   r   c                >   t          |          r | j        |g|R d|i|S t          |          sJ t          | j                  }g }| j                            | j                  D ]R\  }}	t          	                    |	d|            ||	g|R i |}
|
                     ||
|	j                             S|r)ddlm}  ||d          }|                     |          }n%| j                            t           j                  }| j        j        |_        |S )	z3
        Transform with a callable `func`.
        r   ri   r   r   r   T)ignore_indexru   )r/   _transform_with_numbacallablerw   rg   r   get_iteratorrs   object__setattr__appendr   pandas.core.reshape.concatr   _set_result_index_orderedr   npfloat64ri   )rL   r   r   r   rD   rF   klassr   ri   groupr   r   concatenatedr   s                 rM   _transform_generalz SeriesGroupBy._transform_general#  sn    6"" 	-4-  +8<B   ~~~TX=55%
 
 	: 	:KD% ufd333$u.t...v..CNN55EK8889999  	=999999!6'===L33LAAFFX***<<FhmrO   Tdropnac                @   	 t          t                    rfd	nfd	d		fd	  fd j                             j                  D             }n)# t
          t          f$ r}t          d          |d}~ww xY w                     ||          }|S )
aS  
        Filter elements from groups that don't satisfy a criterion.

        Elements from groups are filtered if they do not satisfy the
        boolean criterion specified by func.

        Parameters
        ----------
        func : function
            Criterion to apply to each group. Should return True or False.
        dropna : bool, optional
            Drop groups that do not pass the filter. True by default; if False,
            groups that evaluate False are filled with NaNs.
        *args : tuple
            Optional positional arguments to pass to `func`.
        **kwargs : dict
            Optional keyword arguments to pass to `func`.

        Returns
        -------
        Series
            The filtered subset of the original Series.

        See Also
        --------
        Series.filter: Filter elements of ungrouped Series.
        DataFrameGroupBy.filter : Filter elements from groups base on criterion.

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

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "A": ["foo", "bar", "foo", "bar", "foo", "bar"],
        ...         "B": [1, 2, 3, 4, 5, 6],
        ...         "C": [2.0, 5.0, 8.0, 1.0, 2.0, 9.0],
        ...     }
        ... )
        >>> grouped = df.groupby("A")
        >>> df.groupby("A").B.filter(lambda x: x.mean() > 3.0)
        1    2
        3    4
        5    6
        Name: B, dtype: int64
        c                0     t          |           i S rK   r   r   s    rM   r   z&SeriesGroupBy.filter.<locals>.<lambda>z  s!     04 0 0$ A& A A rO   c                     | gR i S rK   rC   r   s    rM   r   z&SeriesGroupBy.filter.<locals>.<lambda>|  s!    Q 8 8 8 8 8 8 rO   rH   ro   c                <     |           }t          |          o|S rK   )r   )r   bwrappers     rM   true_and_notnaz,SeriesGroupBy.filter.<locals>.true_and_notna  s     

A88>!rO   c                V    g | ]%\  }} |                               |          &S rC   )
_get_index)r   ri   r   rL   r  s      rM   r   z(SeriesGroupBy.filter.<locals>.<listcomp>  sI       D%!>%((%%  rO   z'the filter must return a boolean resultN)rH   ro   )r   r   r   r   rs   
ValueErrorrv   _apply_filter)
rL   r   r   rD   rF   indicesr   filteredr  r  s
   `` ``   @@rM   filterzSeriesGroupBy.filterF  s   f dC   	9AAAAAAGG888888G	" 	" 	" 	" 	" 	"	P    #'=#=#=d>W#X#X  GG
 I& 	P 	P 	PEFFCO	P %%gv66s   ,A B0B  BSeries | DataFramec                   | j         j        }| j         j        }| j        j        }t          j        ||d          \  }}| j         j        r|dk    }||         }||         }t          ||g|t          |          fd|          }|r+|dk    }| 
                                r||         }||         }t          |d          }t          j        ||          |          }	t          |	          }	| j         j        }
| j                            |	|
| j        j                  }| j        s6|                     |          }t)          t          |                    |_        |S )a  
        Return number of unique elements in the group.

        Parameters
        ----------
        dropna : bool, default True
            Don't include NaN in the counts.

        Returns
        -------
        Series
            Number of unique values within each group.

        See Also
        --------
        core.resample.Resampler.nunique : Method nunique for Resampler.

        Examples
        --------
        >>> lst = ["a", "a", "b", "b"]
        >>> ser = pd.Series([1, 2, 3, 3], index=lst)
        >>> ser
        a    1
        a    2
        b    3
        b    3
        dtype: int64
        >>> ser.groupby(level=0).nunique()
        a    2
        b    1
        dtype: int64
        F)use_na_sentinelsortr   )labelsshaper  xnullfirst)	minlengthr   )r   idsr   rg   r   r    	factorizehas_dropped_nar.   r   r   r   r   bincountr   r   r   ri   r   r   r,   r   )rL   r   r  r   r   codesuniquesmaskgroup_indexr   rir   s               rM   nuniquezSeriesGroupBy.nunique  so   B m-'h#-c6PUVVVw=' 	 !8Dd)C$KE%<CLL)	
 
 
  	0!#D{{}} 0$i)$/+w//k#te*8883]'%)X%:%:r &; &
 &
 } 	60088F(V55FLrO   c                L    t                                          |||          S )a<  
        Generate descriptive statistics.

        Descriptive statistics include those that summarize the central
        tendency, dispersion and shape of a
        dataset's distribution, excluding ``NaN`` values.

        Analyzes both numeric and object series, as well
        as ``DataFrame`` column sets of mixed data types. The output
        will vary depending on what is provided. Refer to the notes
        below for more detail.

        Parameters
        ----------
        percentiles : list-like of numbers, optional
            The percentiles to include in the output. All should
            fall between 0 and 1. The default, ``None``, will automatically
            return the 25th, 50th, and 75th percentiles.
        include : 'all', list-like of dtypes or None (default), optional
            A white list of data types to include in the result. Ignored
            for ``Series``. Here are the options:

            - 'all' : All columns of the input will be included in the output.
            - A list-like of dtypes : Limits the results to the
              provided data types.
              To limit the result to numeric types submit
              ``numpy.number``. To limit it instead to object columns submit
              the ``numpy.object`` data type. Strings
              can also be used in the style of
              ``select_dtypes`` (e.g. ``df.describe(include=['O'])``). To
              select pandas categorical columns, use ``'category'``
            - None (default) : The result will include all numeric columns.
        exclude : list-like of dtypes or None (default), optional,
            A black list of data types to omit from the result. Ignored
            for ``Series``. Here are the options:

            - A list-like of dtypes : Excludes the provided data types
              from the result. To exclude numeric types submit
              ``numpy.number``. To exclude object columns submit the data
              type ``numpy.object``. Strings can also be used in the style of
              ``select_dtypes`` (e.g. ``df.describe(exclude=['O'])``). To
              exclude pandas categorical columns, use ``'category'``
            - None (default) : The result will exclude nothing.

        Returns
        -------
        Series or DataFrame
            Summary statistics of the Series or Dataframe provided.

        See Also
        --------
        DataFrame.count: Count number of non-NA/null observations.
        DataFrame.max: Maximum of the values in the object.
        DataFrame.min: Minimum of the values in the object.
        DataFrame.mean: Mean of the values.
        DataFrame.std: Standard deviation of the observations.
        DataFrame.select_dtypes: Subset of a DataFrame including/excluding
            columns based on their dtype.

        Notes
        -----
        For numeric data, the result's index will include ``count``,
        ``mean``, ``std``, ``min``, ``max`` as well as lower, ``50`` and
        upper percentiles. By default the lower percentile is ``25`` and the
        upper percentile is ``75``. The ``50`` percentile is the
        same as the median.

        For object data (e.g. strings), the result's index
        will include ``count``, ``unique``, ``top``, and ``freq``. The ``top``
        is the most common value. The ``freq`` is the most common value's
        frequency.

        If multiple object values have the highest count, then the
        ``count`` and ``top`` results will be arbitrarily chosen from
        among those with the highest count.

        For mixed data types provided via a ``DataFrame``, the default is to
        return only an analysis of numeric columns. If the DataFrame consists
        only of object and categorical data without any numeric columns, the
        default is to return an analysis of both the object and categorical
        columns. If ``include='all'`` is provided as an option, the result
        will include a union of attributes of each type.

        The `include` and `exclude` parameters can be used to limit
        which columns in a ``DataFrame`` are analyzed for the output.
        The parameters are ignored when analyzing a ``Series``.

        Examples
        --------
        Describing a numeric ``Series``.

        >>> s = pd.Series([1, 2, 3, 4])

        >>> s
        0    1
        1    2
        2    3
        3    4
        dtype: int64

        >>> s.groupby([1, 1, 2, 2]).describe()
           count  mean       std  min   25%  50%   75%  max
        1    2.0   1.5  0.707107  1.0  1.25  1.5  1.75  2.0
        2    2.0   3.5  0.707107  3.0  3.25  3.5  3.75  4.0
        )percentilesincludeexclude)r}   describe)rL   r$  r%  r&  r   s       rM   r'  zSeriesGroupBy.describe  s.    T ww#Wg   
 
 	
rO   	normalizer  	ascendingc                  &'()* |rdnd}|"|                      ||||          }||_        |S ddlm} ddlm}	 | j        j        }
| j        j	        }g | j        j
        | j        j        }t          |j        t                    s|Mt          j        |          s9|                     t"          j        ||||          }||_        ||j        _
        |S |
d	k    (|
(         |(         }}
|t)          j        |d
          \  }}d }n^ |	t#          |d          |d
          }t-          d|j	                  }|j        }|                    |j        d
|j                  }d }t          |j        t6                    r7t-          t8          |          }t          j        |j        |j        |
f          }nt          j        ||
f          }|
|         ||         }}
dt          j         |
dd         |
dd	         k              d         z   }t          j!        d|f         }tE          |
          s|} ||tG          dd                     ||tG          dd	                    k    }t          j!        d
|f         }tE          |          s|}d
||<   t          j$        t          j         t          j!        |d
f                   d                   }tK          t          j&        t          j'        (                    ||                    *t          | j        j)        tT                    rtW          | j        j)        j                  }n<t)          j        | j        j)        | j        j,        | j        j-                  d         g}*fd|D              |||          gz   }g | j        j.        |}|r9|d	         d	k    ((/                                rd}n|(         (fd|D             }}|r|0                    d          }t          j$        t          j!        |tE          |
          f                   }|r?|
|d	k             }t          j'        1                    ||d	            *|          (         }n *|          }||z  }|rO|M|r|
|         (         n|
|         }t          j        |r|n| |f          }||         |d	         |         c}|d	<   |t          j2        tE          |          d          '|dd	         D ]-} 't          j!        d
| dd         | dd	         k    f         z  '.'3                                tE          |d	                   c}!)t          j&        t          j4        |!          )          t          j5        t          j4        )          |!          g}"'6                                dz
  |d	         g}# ||"|#dd          \  }$}| t          j7        |d	k    ||         d          }|r;t          j        |r|n| |"d         f          }||         |"d	         |         c}|"d	<   d$')fd &&fd!|dd	         D             }|8                    |"d	                    tU          |||d"          }%ts          |j                  rtu          |          }| j        ;                    ||%|#          }| j<        s|=                                }|S )%a	  
        Return a Series or DataFrame containing counts of unique rows.

        Parameters
        ----------
        normalize : bool, default False
            Return proportions rather than frequencies.
        sort : bool, default True
            Sort by frequencies.
        ascending : bool, default False
            Sort in ascending order.
        bins : int or list of ints, optional
            Rather than count values, group them into half-open bins,
            a convenience for pd.cut, only works with numeric data.
        dropna : bool, default True
            Don't include counts of rows that contain NA values.

        Returns
        -------
        Series or DataFrame
            Series if the groupby ``as_index`` is True, otherwise DataFrame.

        See Also
        --------
        Series.value_counts: Equivalent method on Series.
        DataFrame.value_counts: Equivalent method on DataFrame.
        DataFrameGroupBy.value_counts: Equivalent method on DataFrameGroupBy.

        Notes
        -----
        - If the groupby ``as_index`` is True then the returned Series will have a
          MultiIndex with one level per input column.
        - If the groupby ``as_index`` is False then the returned DataFrame will have an
          additional column with the value_counts. The column is labelled 'count' or
          'proportion', depending on the ``normalize`` parameter.

        By default, rows that contain any NA values are omitted from
        the result.

        By default, the result will be in descending order so that the
        first element of each group is the most frequently-occurring row.

        Examples
        --------
        >>> s = pd.Series(
        ...     [1, 1, 2, 3, 2, 3, 3, 1, 1, 3, 3, 3],
        ...     index=["A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B"],
        ... )
        >>> s
        A    1
        A    1
        A    2
        A    3
        A    2
        A    3
        B    3
        B    1
        B    1
        B    3
        B    3
        B    3
        dtype: int64
        >>> g1 = s.groupby(s.index)
        >>> g1.value_counts(bins=2)
        A  (0.997, 2.0]    4
           (2.0, 3.0]      2
        B  (2.0, 3.0]      4
           (0.997, 2.0]    2
        Name: count, dtype: int64
        >>> g1.value_counts(normalize=True)
        A  1    0.333333
           2    0.333333
           3    0.333333
        B  3    0.666667
           1    0.333333
        Name: proportion, dtype: float64
        
proportioncountN)r(  r  r)  r   r   )get_join_indexers)cut)r(  r  r)  binsT)r  c                    | |         S rK   rC   labincs     rM   r   z,SeriesGroupBy.value_counts.<locals>.<lambda>  s
    CH rO   F)copy)include_lowestr:   )
allow_fill
fill_valuec                2    | |         j         j        d         S )Nr0  )_multiindexr  r2  s     rM   r   z,SeriesGroupBy.value_counts.<locals>.<lambda>  s    CH$8$>r$B rO   rS   )repeats)r  r  c                &    g | ]} |          S rC   rC   )r   level_codesreps     rM   r   z.SeriesGroupBy.value_counts.<locals>.<listcomp>  s#    ;;;k[!!;;;rO   c                     g | ]
}|         S rC   rC   )r   r=  r  s     rM   r   z.SeriesGroupBy.value_counts.<locals>.<listcomp>  s    (T(T(T{T):(T(T(TrO   floatro   r   left)r  r   	lev_codes
np.ndarrayrH   c                :    t          j        |                    S rK   )r   repeat)rB  diffnbins    rM   build_codesz/SeriesGroupBy.value_counts.<locals>.build_codes+  s    y4$777rO   c                &    g | ]} |          S rC   rC   )r   rB  rH  s     rM   r   z.SeriesGroupBy.value_counts.<locals>.<listcomp>.  s#    HHH	[[++HHHrO   )levelsr  namesverify_integrityr   )rB  rC  rH   rC  )>_value_countsri   pandas.core.reshape.merger-  pandas.core.reshape.tiler.  r   r  rg   r   rK  r   ru   r   r   iterabler~   r-   value_countsr   r    r  r   
categoriestaker  	_na_valuer   r   lexsortrA  rightnonzeror_r   slicerF  r   rE  addreduceatr   r*   r   _sortr   rJ  allastypeatzerossumarangetilecumsumwherer   r   r   r   r   r   )+rL   r(  r  r)  r/  r   ri   r   r-  r.  r  r   index_namesrx   r3  levllabcat_sercat_objlab_intervalsorter	idchangesr   lchangesr4  rk   r  rJ  dmacccatr=  ncatrA  rV  _mirH  rF  r  rG  r>  s+                                         @@@@@rM   rQ  zSeriesGroupBy.value_countsB  sS   j  )5||g<''#$)F (  F FKM??????000000mh;+;TX];ci!122 	R[%6%6
 **###   C CH)CIOJ byt9c$iS <!+Cd;;;HC,,DD c&51114MMMG='/::G$C((=   C
 CBDci// 	,#..LZ!2L4F LMMFFZc
++Fv;FS 
3qrr7c#2#h#677::	eAyL!3xx 	C 4U1d^^,,S%b//0J0JJeD(N#3xx 	CCgbjsDy!1221566 bic)B)BCCC dm0*== 		39::EE $M.,$(M$8   	E <;;;U;;;ttC~~>NN-4='-- 	U9?Dxxzz U Y(T(T(T(Te(T(T(TU 		**W%%Cc3s88m,--A r	N		!Q###c!ffTlc!ff3JC 	<DL$*8#c(4..CCZ	!;tS ABBF [%)F*;NCr 8CHHF333D$SbSz I IdKO{3B37G$GGHHS__JD$Ibioot44bgbioot6T6TUD[[]]Q&b	2E
 '&	  FAs hsby#c(A66 >I%?SSC4a$IJJ #FT"Xf-=T"X8 8 8 8 8 8 8 IHHHU3B3ZHHHELLb"""kE
 
 
 CI&& 	$s##C&&s"4&@@} 	*''))FrO   r  r9   c                $     | j         dd|i|}|S )a	  
        Return the elements in the given *positional* indices in each group.

        This means that we are not indexing according to actual values in
        the index attribute of the object. We are indexing according to the
        actual position of the element in the object.

        If a requested index does not exist for some group, this method will raise.
        To get similar behavior that ignores indices that don't exist, see
        :meth:`.SeriesGroupBy.nth`.

        Parameters
        ----------
        indices : array-like
            An array of ints indicating which positions to take in each group.

        **kwargs
            For compatibility with :meth:`numpy.take`. Has no effect on the
            output.

        Returns
        -------
        Series
            A Series containing the elements taken from each group.

        See Also
        --------
        Series.take : Take elements from a Series along an axis.
        Series.loc : Select a subset of a DataFrame by labels.
        Series.iloc : Select a subset of a DataFrame by positions.
        numpy.take : Take elements from an array along an axis.
        SeriesGroupBy.nth : Similar to take, won't raise if indices don't exist.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     [
        ...         ("falcon", "bird", 389.0),
        ...         ("parrot", "bird", 24.0),
        ...         ("lion", "mammal", 80.5),
        ...         ("monkey", "mammal", np.nan),
        ...         ("rabbit", "mammal", 15.0),
        ...     ],
        ...     columns=["name", "class", "max_speed"],
        ...     index=[4, 3, 2, 1, 0],
        ... )
        >>> df
             name   class  max_speed
        4  falcon    bird      389.0
        3  parrot    bird       24.0
        2    lion  mammal       80.5
        1  monkey  mammal        NaN
        0  rabbit  mammal       15.0
        >>> gb = df["name"].groupby([1, 1, 2, 2, 2])

        Take elements at rows 0 and 1 in each group.

        >>> gb.take([0, 1])
        1  4    falcon
           3    parrot
        2  2      lion
           1    monkey
        Name: name, dtype: str

        We may take elements using negative integers for positive indices,
        starting from the end of the object, just like with Python lists.

        >>> gb.take([-1, -2])
        1  3    parrot
           4    falcon
        2  0    rabbit
           1    monkey
        Name: name, dtype: str
        rS  r  rS  _op_via_applyrL   r  rF   r   s       rM   rS  zSeriesGroupBy.take<  s'    ^ $#FFGFvFFrO   skipnac                &     | j         	 dd||d|S )a  
        Return unbiased skew within groups.

        Normalized by N-1.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA/null values when computing the result.

        numeric_only : bool, default False
            Include only float, int, boolean columns. Not implemented for Series.

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

        Returns
        -------
        Series
            Unbiased skew within groups.

        See Also
        --------
        Series.skew : Return unbiased skew over requested axis.

        Examples
        --------
        >>> ser = pd.Series(
        ...     [390.0, 350.0, 357.0, np.nan, 22.0, 20.0, 30.0],
        ...     index=[
        ...         "Falcon",
        ...         "Falcon",
        ...         "Falcon",
        ...         "Falcon",
        ...         "Parrot",
        ...         "Parrot",
        ...         "Parrot",
        ...     ],
        ...     name="Max Speed",
        ... )
        >>> ser
        Falcon    390.0
        Falcon    350.0
        Falcon    357.0
        Falcon      NaN
        Parrot     22.0
        Parrot     20.0
        Parrot     30.0
        Name: Max Speed, dtype: float64
        >>> ser.groupby(level=0).skew()
        Falcon    1.525174
        Parrot    1.457863
        Name: Max Speed, dtype: float64
        >>> ser.groupby(level=0).skew(skipna=False)
        Falcon         NaN
        Parrot    1.457863
        Name: Max Speed, dtype: float64
        skewNaltr{  rn   r}  _cython_agg_generalrL   r{  rn   rF   s       rM   r}  zSeriesGroupBy.skew  s8    B (t'
V,
 
JP
 
 	
rO   c                ,    d } | j         	 d|||d|S )a  
        Return unbiased kurtosis within groups.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA/null values when computing the result.

        numeric_only : bool, default False
            Include only float, int, boolean columns. Not implemented for Series.

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

        Returns
        -------
        Series
            Unbiased kurtosis within groups.

        See Also
        --------
        Series.kurt : Return unbiased kurtosis over requested axis.

        Examples
        --------
        >>> ser = pd.Series(
        ...     [390.0, 350.0, 357.0, 333.0, np.nan, 22.0, 20.0, 30.0, 40.0, 41.0],
        ...     index=[
        ...         "Falcon",
        ...         "Falcon",
        ...         "Falcon",
        ...         "Falcon",
        ...         "Falcon",
        ...         "Parrot",
        ...         "Parrot",
        ...         "Parrot",
        ...         "Parrot",
        ...         "Parrot",
        ...     ],
        ...     name="Max Speed",
        ... )
        >>> ser
        Falcon    390.0
        Falcon    350.0
        Falcon    357.0
        Falcon    333.0
        Falcon      NaN
        Parrot     22.0
        Parrot     20.0
        Parrot     30.0
        Parrot     40.0
        Parrot     41.0
        Name: Max Speed, dtype: float64
        >>> ser.groupby(level=0).kurt()
        Falcon    1.622109
        Parrot   -2.878714
        Name: Max Speed, dtype: float64
        >>> ser.groupby(level=0).kurt(skipna=False)
        Falcon         NaN
        Parrot   -2.878714
        Name: Max Speed, dtype: float64
        c                0    t          d| j                   )Nz"'kurt' is not supported for dtype=rv   ru   rg   s    rM   r  zSeriesGroupBy.kurt.<locals>.alt       LLLMMMrO   kurtr~  r  r  rL   r{  rn   rF   r  s        rM   r  zSeriesGroupBy.kurt  sJ    J	N 	N 	N
 (t'
F
 
IO
 
 	
rO   r(   c                $    t          |           }|S )a5  
        Make plots of groups from a Series.

        Uses the backend specified by the option ``plotting.backend``.
        By default, matplotlib is used.

        Returns
        -------
        GroupByPlot
            A plotting object that can be used to create plots for each group.

        See Also
        --------
        Series.plot : Make plots of Series.

        Examples
        --------
        >>> ser = pd.Series([1, 2, 3, 4, 5], index=["a", "a", "b", "b", "c"])
        >>> g = ser.groupby(level=0)
        >>> g.plot()  # doctest: +SKIP
        r(   rL   r   s     rM   plotzSeriesGroupBy.plot!  s    . T""rO      r  nrQ   keepLiteral['first', 'last', 'all']c                |    t          t          j        ||          }| j        }|                     ||d          }|S )a  
        Return the largest `n` elements.

        Parameters
        ----------
        n : int, default 5
            Return this many descending sorted values.
        keep : {'first', 'last', 'all'}, default 'first'
            When there are duplicate values that cannot all fit in a
            Series of `n` elements:

            - ``first`` : return the first `n` occurrences in order
              of appearance.
            - ``last`` : return the last `n` occurrences in reverse
              order of appearance.
            - ``all`` : keep all occurrences. This can result in a Series of
              size larger than `n`.

        Returns
        -------
        Series
            The `n` largest values in the Series, sorted in decreasing order.

        See Also
        --------
        Series.nsmallest: Get the `n` smallest elements.
        Series.sort_values: Sort Series by values.
        Series.head: Return the first `n` rows.

        Notes
        -----
        Faster than ``.sort_values(ascending=False).head(n)`` for small `n`
        relative to the size of the ``Series`` object.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4, 5, 6])

        >>> s
        0    1
        1    2
        2    3
        3    4
        4    5
        5    6
        dtype: int64

        >>> s.groupby([1, 1, 1, 2, 2, 2]).nlargest(n=2)
        1  2    3
           1    2
        2  5    6
           4    5
        dtype: int64
        r  r  Tr   )r   r-   nlargestrs   _python_apply_generalrL   r  r  r   r   r   s         rM   r  zSeriesGroupBy.nlargest;  sD    r FOqt444( ++Atd+KKrO   c                |    t          t          j        ||          }| j        }|                     ||d          }|S )a  
        Return the smallest `n` elements.

        Parameters
        ----------
        n : int, default 5
            Return this many ascending sorted values.
        keep : {'first', 'last', 'all'}, default 'first'
            When there are duplicate values that cannot all fit in a
            Series of `n` elements:

            - ``first`` : return the first `n` occurrences in order
              of appearance.
            - ``last`` : return the last `n` occurrences in reverse
              order of appearance.
            - ``all`` : keep all occurrences. This can result in a Series of
              size larger than `n`.

        Returns
        -------
        Series
            The `n` smallest values in the Series, sorted in increasing order.

        See Also
        --------
        Series.nlargest: Get the `n` largest elements.
        Series.sort_values: Sort Series by values.
        Series.head: Return the first `n` rows.

        Notes
        -----
        Faster than ``.sort_values().head(n)`` for small `n` relative to
        the size of the ``Series`` object.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4, 5, 6])

        >>> s
        0    1
        1    2
        2    3
        3    4
        4    5
        5    6
        dtype: int64

        >>> s.groupby([1, 1, 1, 2, 2, 2]).nsmallest(n=2)
        1  0    1
           1    2
        2  3    4
           4    5
        dtype: int64
        r  Tr  )r   r-   	nsmallestrs   r  r  s         rM   r  zSeriesGroupBy.nsmallest{  sE    r F$555( ++Atd+KKrO   c                0    |                      d|          S )a  
        Return the row label of the minimum value.

        If multiple values equal the minimum, the first row label with that
        value is returned.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA values.

        Returns
        -------
        Series
            Indexes of minima in each group.

        Raises
        ------
        ValueError
            When there are no valid values for a group. Then can happen if:

                * There is an unobserved group and ``observed=False``.
                * All values for a group are NA.
                * Some values for a group are NA and ``skipna=False``.

        .. versionchanged:: 3.0.0
            Previously if all values for a group are NA or some values for a group are
            NA and ``skipna=False``, this method would return NA. Now it raises instead.

        See Also
        --------
        numpy.argmin : Return indices of the minimum values
            along the given axis.
        DataFrame.idxmin : Return index of first occurrence of minimum
            over requested axis.
        Series.idxmax : Return index *label* of the first occurrence
            of maximum of values.

        Examples
        --------
        >>> 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.groupby(["a", "a", "b", "b"]).idxmin()
        a   2023-01-01
        b   2023-02-01
        dtype: datetime64[us]
        idxminr{  _idxmax_idxminrL   r{  s     rM   r  zSeriesGroupBy.idxmin      v ""8F";;;rO   c                0    |                      d|          S )a  
        Return the row label of the maximum value.

        If multiple values equal the maximum, the first row label with that
        value is returned.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA values.

        Returns
        -------
        Series
            Indexes of maxima in each group.

        Raises
        ------
        ValueError
            When there are no valid values for a group. Then can happen if:

                * There is an unobserved group and ``observed=False``.
                * All values for a group are NA.
                * Some values for a group are NA and ``skipna=False``.

        .. versionchanged:: 3.0.0
            Previously if all values for a group are NA or some values for a group are
            NA and ``skipna=False``, this method would return NA. Now it raises instead.

        See Also
        --------
        numpy.argmax : Return indices of the maximum values
            along the given axis.
        DataFrame.idxmax : Return index of first occurrence of maximum
            over requested axis.
        Series.idxmin : Return index *label* of the first occurrence
            of minimum of values.

        Examples
        --------
        >>> 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.groupby(["a", "a", "b", "b"]).idxmax()
        a   2023-01-15
        b   2023-02-15
        dtype: datetime64[us]
        idxmaxr  r  r  s     rM   r  zSeriesGroupBy.idxmax  r  rO   pearsonotherr   r5   min_periods
int | Nonec                8    |                      d|||          }|S )a!  
        Compute correlation between each group and another Series.

        Parameters
        ----------
        other : Series
            Series to compute correlation with.
        method : {'pearson', 'kendall', 'spearman'}, default 'pearson'
            Method of correlation to use.
        min_periods : int, optional
            Minimum number of observations required per pair of columns to
            have a valid result.

        Returns
        -------
        Series
            Correlation value for each group.

        See Also
        --------
        Series.corr : Equivalent method on ``Series``.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4], index=[0, 0, 1, 1])
        >>> g = s.groupby([0, 0, 1, 1])
        >>> g.corr()  # doctest: +SKIP
        corr)r  r   r  rx  )rL   r  r   r  r   s        rM   r  zSeriesGroupBy.corr5  s/    D ##%K $ 
 
 rO   rS   ddofc                8    |                      d|||          }|S )a  
        Compute covariance between each group and another Series.

        Parameters
        ----------
        other : Series
            Series to compute covariance with.
        min_periods : int, optional
            Minimum number of observations required per pair of columns to
            have a valid result.
        ddof : int, optional
            Delta degrees of freedom for variance calculation.

        Returns
        -------
        Series
            Covariance value for each group.

        See Also
        --------
        Series.cov : Equivalent method on ``Series``.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4], index=[0, 0, 1, 1])
        >>> g = s.groupby([0, 0, 1, 1])
        >>> g.cov()  # doctest: +SKIP
        cov)r  r  r  rx  )rL   r  r  r  r   s        rM   r  zSeriesGroupBy.cov\  s.    > ##Kd $ 
 
 rO   c                .    |                      d           S )a  
        Return whether each group's values are monotonically increasing.

        Returns
        -------
        Series

        See Also
        --------
        SeriesGroupBy.is_monotonic_decreasing : Return whether each group's values
            are monotonically decreasing.

        Examples
        --------
        >>> s = pd.Series([2, 1, 3, 4], index=["Falcon", "Falcon", "Parrot", "Parrot"])
        >>> s.groupby(level=0).is_monotonic_increasing
        Falcon    False
        Parrot     True
        dtype: bool
        c                    | j         S rK   )is_monotonic_increasingrx   s    rM   r   z7SeriesGroupBy.is_monotonic_increasing.<locals>.<lambda>  	    c&A rO   r~   rL   s    rM   r  z%SeriesGroupBy.is_monotonic_increasing      , zzAABBBrO   c                .    |                      d           S )a  
        Return whether each group's values are monotonically decreasing.

        Returns
        -------
        Series

        See Also
        --------
        SeriesGroupBy.is_monotonic_increasing : Return whether each group's values
            are monotonically increasing.

        Examples
        --------
        >>> s = pd.Series([2, 1, 3, 4], index=["Falcon", "Falcon", "Parrot", "Parrot"])
        >>> s.groupby(level=0).is_monotonic_decreasing
        Falcon     True
        Parrot    False
        dtype: bool
        c                    | j         S rK   )is_monotonic_decreasingr  s    rM   r   z7SeriesGroupBy.is_monotonic_decreasing.<locals>.<lambda>  r  rO   r  r  s    rM   r  z%SeriesGroupBy.is_monotonic_decreasing  r  rO   
   grid
xlabelsizexrotfloat | None
ylabelsizeyrotfigsizetuple[float, float] | Noner/  int | Sequence[int]backendlegendc                :     | j         	 d|||||||||	|
|d|}|S )a1  
        Draw histogram for each group's values using :meth:`Series.hist` API.

        Parameters
        ----------
        by : object, optional
            Grouping key.
        ax : matplotlib.axes.Axes, optional
            Axis to draw the histogram on.
        grid : bool, default True
            Show axis grid lines.
        xlabelsize : int, default None
            X axis label size.
        xrot : float, default None
            Rotation for x ticks.
        ylabelsize : int, default None
            Y axis label size.
        yrot : float, default None
            Rotation for y ticks.
        figsize : tuple, optional
            Figure size in inches.
        bins : int or sequence, default 10
            Number of histogram bins or bin edges.
        backend : str or callable or None, optional
            Plotting backend to use (e.g. 'matplotlib'). If None, use the default
            plotting backend.
        legend : bool, default False
            Whether to draw the legend.
        **kwargs
            Additional keyword arguments passed to :meth:`Series.hist`.

        Returns
        -------
        matplotlib.axes.Axes or ndarray of Axes
            The returned matplotlib axes or array of axes depending on input.

        See Also
        --------
        Series.hist : Equivalent histogram plotting method on Series.

        Examples
        --------
        >>> df = pd.DataFrame({"val": [1, 2, 2, 3, 3, 3]}, index=[0, 0, 1, 1, 2, 2])
        >>> g = df["val"].groupby([0, 0, 1, 1, 2, 2])
        >>> g.hist()  # doctest: +SKIP
        hist)byaxr  r  r  r  r  r  r/  r  r  r  rx  )rL   r  r  r  r  r  r  r  r  r/  r  r  rF   r   s                 rM   r  zSeriesGroupBy.hist  sX    z $#
!!
 
 
 
 rO   c                .    |                      d           S )z
        Return the dtype object of the underlying data for each group.

        Mirrors :meth:`Series.dtype` applied group-wise.

        Returns
        -------
        Series
            Dtype of each group's values.
        c                    | j         S rK   r   r  s    rM   r   z%SeriesGroupBy.dtype.<locals>.<lambda>
  s    ci rO   r  r  s    rM   ru   zSeriesGroupBy.dtype  s     zz//000rO   c                0    |                      d          }|S )ad  
        Return unique values for each group.

        It returns unique values for each of the grouped values. Returned in
        order of appearance. Hash table-based unique, therefore does NOT sort.

        Returns
        -------
        Series
            Unique values for each of the grouped values.

        See Also
        --------
        Series.unique : Return unique values of Series object.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     [
        ...         ("Chihuahua", "dog", 6.1),
        ...         ("Beagle", "dog", 15.2),
        ...         ("Chihuahua", "dog", 6.9),
        ...         ("Persian", "cat", 9.2),
        ...         ("Chihuahua", "dog", 7),
        ...         ("Persian", "cat", 8.8),
        ...     ],
        ...     columns=["breed", "animal", "height_in"],
        ... )
        >>> df
               breed     animal   height_in
        0  Chihuahua        dog         6.1
        1     Beagle        dog        15.2
        2  Chihuahua        dog         6.9
        3    Persian        cat         9.2
        4  Chihuahua        dog         7.0
        5    Persian        cat         8.8
        >>> ser = df.groupby("animal")["breed"].unique()
        >>> ser
        animal
        cat              [Persian]
        dog    [Chihuahua, Beagle]
        Name: breed, dtype: object
        uniquerx  r  s     rM   r  zSeriesGroupBy.unique  s    X ##H--rO   )rb   r7   rH   r-   )rn   ro   ri   rp   rH   r8   )rH   r-   rK   rH   r%   FF)
r   r-   r   r   r   ro   r   ro   rH   r   F)r   r   rn   ro   )r   r   rH   r-   T)r   ro   )r   ro   rH   r  )NNN)FTFNT)
r(  ro   r  ro   r)  ro   r   ro   rH   r  )r  r9   rH   r-   TF)r{  ro   rn   ro   rH   r-   rH   r(   )r  r  )r  rQ   r  r  rH   r-   )r{  ro   rH   r-   )r  N)r  r-   r   r5   r  r  rH   r-   NrS   )r  r-   r  r  r  r  rH   r-   )NNTNNNNNr  NF)r  ro   r  r  r  r  r  r  r  r  r  r  r/  r  r  rp   r  ro   )%rX   rY   rZ   rl   r{   r~   r   aggr   r   r   r   #_SeriesGroupBy__examples_series_docr   r   r   r  r"  r'  rQ  rS  r}  r  propertyr  r  r  r  r  r  r  r  r  r  ru   r  __classcell__r   s   @rM   ra   ra      s           ',     g4 g4 g4 g4 g4 g4RsCT sC sC sC sC sCj C1 1 1   J "'"FC FC FC FC FCP #F%	' 'R -1 I
 I
 I
 I
 I
VM M M M M! ! ! !FG G G G GRC C C C CJl
 l
 l
 l
 l
 l
 l
`  x x x x xtP P P Ph "C
 C
 C
 C
 C
N "L
 L
 L
 L
 L
\    X4 CJ> > > > >B CJ> > > > >@;< ;< ;< ;< ;<z;< ;< ;< ;< ;<@ %."&	% % % % %P QR" " " " "H C C C XC. C C C XC2 !%!!%!.2$&"L L L L L\ 1 1 1 X1- - - - - - - -rO   ra   c                      e Zd ZddddddZeZd ZdedZ	 	 dfdgdZdhdZ	 didjdZ	d Z
 ed          ZddddZd Zdkd!Zdldmd$Zdn fd&Zdddod)Zddd*dpd.Zdqd0Zded1Zdldmd2Z	 	 drdsd4Z	 	 drdsd5ZeZ	 	 	 	 	 dtdud;Zdvd>Z	 	 drdsd?Z	 	 drdsd@ZedwdB            Z 	 	 	 dxdydHZ!	 	 	 dzd{dKZ"	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d|d}d_Z#	 	 	 d~ddcZ$ xZ%S )DataFrameGroupByNr   c               P   t          |fi |\  }}}}t          |          }t          |          r
||d<   ||d<   t          | |||          }	|	                                }
t          |          s.|
,| j        s#t          |          r|
                                S |
S |rBt          t          |
          }
|
j        dd|f         }
t          t          |
          }
||
_        |
d|v r|d= |d= t          |          r | j        |g|R d|i|S | j        j        dk    r | j        |g|R i |S |s|r | j        |g|R i |}
nt          | |gdi           }	 |                                }
t          t          |
          }
| j        j                                        |
_        n># t(          $ r1}dt+          |          vr |                     |          }
Y d}~nd}~ww xY w| j        s6|                     |
          }
t/          t1          |
                    |
_        |
S )a  
        Aggregate using one or more operations.

        The ``aggregate`` function allows the application of one or more aggregation
        operations on groups of data within a DataFrameGroupBy object. It supports
        various aggregation methods, including user-defined functions and predefined
        functions such as 'sum', 'mean', etc.

        Parameters
        ----------
        func : function, str, list, dict or None
            Function to use for aggregating the data. If a function, must either
            work when passed a DataFrame or when passed to DataFrame.apply.

            Accepted combinations are:

            - function
            - string function name
            - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
            - dict of index labels -> functions, function names or list of such.
            - None, in which case ``**kwargs`` are used with Named Aggregation. Here the
              output has one column for each element in ``**kwargs``. The name of the
              column is keyword, whereas the value determines the aggregation used to
              compute the values in the column.

              Can also accept a Numba JIT function with
              ``engine='numba'`` specified. Only passing a single function is supported
              with this engine.

              If the ``'numba'`` engine is chosen, the function must be
              a user defined function with ``values`` and ``index`` as the
              first and second arguments respectively in the function signature.
              Each group's index will be passed to the user defined function
              and optionally available for use.

        *args
            Positional arguments to pass to func.
        engine : str, default None
            * ``'cython'`` : Runs the function through C-extensions from cython.
            * ``'numba'`` : Runs the function 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 ``nopython``, ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nopython': True, 'nogil': False, 'parallel': False}`` and will be
              applied to the function

        **kwargs
            * If ``func`` is None, ``**kwargs`` are used to define the output names and
              aggregations via Named Aggregation. See ``func`` entry.
            * Otherwise, keyword arguments to be passed into func.

        Returns
        -------
        DataFrame
            Aggregated DataFrame based on the grouping and the applied aggregation
            functions.

        See Also
        --------
        DataFrame.groupby.apply : Apply function func group-wise
            and combine the results together.
        DataFrame.groupby.transform : Transforms the Series on each group
            based on the given function.
        DataFrame.aggregate : Aggregate using one or more operations.

        Notes
        -----
        When using ``engine='numba'``, there will be no "fall back" behavior internally.
        The group data and group index will be passed as numpy arrays to the JITed
        user defined function, and no alternative execution attempts will be tried.

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

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

        Examples
        --------
        >>> data = {
        ...     "A": [1, 1, 2, 2],
        ...     "B": [1, 2, 3, 4],
        ...     "C": [0.362838, 0.227877, 1.267767, -0.562860],
        ... }
        >>> df = pd.DataFrame(data)
        >>> df
           A  B         C
        0  1  1  0.362838
        1  1  2  0.227877
        2  2  3  1.267767
        3  2  4 -0.562860

        The aggregation is for each column.

        >>> df.groupby("A").agg("min")
           B         C
        A
        1  1  0.227877
        2  3 -0.562860

        Multiple aggregations

        >>> df.groupby("A").agg(["min", "max"])
            B             C
          min max       min       max
        A
        1   1   2  0.227877  0.362838
        2   3   4 -0.562860  1.267767

        Select a column for aggregation

        >>> df.groupby("A").B.agg(["min", "max"])
           min  max
        A
        1    1    2
        2    3    4

        User-defined function for aggregation

        >>> df.groupby("A").agg(lambda x: sum(x) + 2)
            B          C
        A
        1       5       2.590715
        2       9       2.704907

        Different aggregations per column

        >>> df.groupby("A").agg({"B": ["min", "max"], "C": "sum"})
            B             C
          min max       sum
        A
        1   1   2  0.590715
        2   3   4  0.704907

        To control the output names with different aggregations per column,
        pandas supports "named aggregation"

        >>> df.groupby("A").agg(
        ...     b_min=pd.NamedAgg(column="B", aggfunc="min"),
        ...     c_sum=pd.NamedAgg(column="C", aggfunc="sum"),
        ... )
           b_min     c_sum
        A
        1      1  0.590715
        2      3  0.704907

        - The keywords are the *output* column names
        - The values are tuples whose first element is the column to select
          and the second element is the aggregation to apply to that column.
          Pandas provides the ``pandas.NamedAgg`` namedtuple with the fields
          ``['column', 'aggfunc']`` to make it clearer what the arguments are.
          As usual, the aggregation can be a callable or a string alias.

        See :ref:`groupby.aggregate.named` for more.

        The resulting dtype will reflect the return value of the aggregating
        function.

        >>> df.groupby("A")[["B"]].agg(lambda x: x.astype(float).min())
              B
        A
        1   1.0
        2   3.0
        r   r   )rD   rF   NrS   rC   zNo objects to concatenate)r#   r"   r/   r!   r  r   r   r   r   r   r%   ilocr   r   r   nkeysr   _aggregate_framers   r5  r  r   r   r,   r   r   )rL   r   r   r   rD   rF   r   r   orderopr   gbar   s                rM   r   zDataFrameGroupBy.aggregate>  s   V ,<D+K+KF+K+K(
D'5#D))6"" 	4  &F8&3F?#$4???D!! 	%f&8= \$%7%7 ))+++ 
	% )V,,F[E*F)V,,F
 %FN> 6!!8$?+ v&& 1t1  /<@F   }"Q&&/t/FtFFFvFFF N N /.tEdEEEfEE #4$bDDDN WWYYF  ")V44F%)%>%F%K%K%M%MFNN " 	9 	9 	92#c((BB "22488FFFFFF	9" } 	60088F(V55FLs   F+ +
G&5'G!!G&c                   fd}| j         dk    r|                     || j        d          S | j        }t	          |j                  s|                     || j                  S i }t          |                                          D ](\  }\  }}	| j        	                    |	|          }
|
||<   )| j
                            |          }|j                            d          |_        |                     |          S )Nc                     | gR i S rK   rC   r   s    rM   r   z6DataFrameGroupBy._python_agg_general.<locals>.<lambda>;	  r   rO   r   T)is_aggF)deep)r   r  _selected_objrs   r   r   r   r   r   r   rg   r   r5  r   )rL   r   rD   rF   r   rg   r   r   ri   rx   r   r   s    ```        rM   r   z$DataFrameGroupBy._python_agg_general:	  s   ......<1 --a1CD-QQQ'3; 	E--a1CDDD') )#))++ 6 6 	! 	!C$]--c155F F3KKh##F++k&&E&22++C000rO   rH   r%   c                "   | j         j        dk    rt          d          | j        }i }| j                             |          D ]\  }} ||g|R i |}|||<   | j         j        }	| j                            ||j        |	          }
|
j	        }
|
S )NrS   zNumber of keys must be 1r   r   )
r   r  AssertionErrorrs   r   r   rg   r   r   T)rL   r   rD   rF   rg   r   ri   grp_dffresr   rk   s              rM   r  z!DataFrameGroupBy._aggregate_frameQ	  s    =!## !;<<<'79 M66s;; 	  	 LD&4000000DF4LL}1h##F#+|#TTe
rO   Fr   r   r   r   ro   r   c                
   t          |          dk    r]|r|j        }n| j        sd }n| j        j        }| j                            ||j                  }|                    |j	                  }|S t          t          j        | d           }|<| j                            |j                  }|                    |j	                  }|S t          |t                    r|                     |||          S | j        r| j        j        nd }t          |t"          j        t&          f          rMt)          | j                  st-          | j                  }	n| j        }	| j                            |||	          S t          |t0                    s\| j        r| j                            ||          S | j                            || j        g          }|                     |          }|S |                     |||||          S )Nr   r  )r   r   r   r   )r   r   r   r   r   rg   r   r   r^  dtypesnextr   not_noner   r%   r   r   r   ndarrayr)   r   
_selectionr   _constructor_slicedr-   r   _wrap_applied_output_series)
rL   r   r   r   r   r   r   first_not_none	key_indexri   s
             rM   r   z%DataFrameGroupBy._wrap_applied_outputb	  s    v;;! 7 J		_ 7 		 M6	X**DL*QQF]]4;//FM clF3T::! X**4<*@@F]]4;//FM	22 	''!1) (    37-IDM..T	nrz5&9:: "	 t// 'T_--
 8//id/SSSNF33 	
 } x33F)3LLL..v?P.QQ44V<< 33   rO   list[Series]r  Index | Noner   c                   |                                 }t          di |fd|D             }t          d |D                       }|s|                     |d|          S t	          j        d |D                       }|}	|j                                        }
|
j        @d |D             }t          |          dk    r!t          t          |                    |
_        |j        t          k    r|                                }| j                            ||	|
          }| j        s|                     |          }|                    | j        d	
          S )Nc                    g | ]}||n	S rK   rC   )r   r   backups     rM   r   z@DataFrameGroupBy._wrap_applied_output_series.<locals>.<listcomp>	  s!    CCCq!!FCCCrO   c              3  $   K   | ]}|j         V  d S rK   r   r   s     rM   r   z?DataFrameGroupBy._wrap_applied_output_series.<locals>.<genexpr>	  s$      +D+DAG+D+D+D+D+D+DrO   Tr   c                6    g | ]}t          j        |          S rC   )r   asarrayr   vs     rM   r   z@DataFrameGroupBy._wrap_applied_output_series.<locals>.<listcomp>	  s     #B#B#BaBJqMM#B#B#BrO   c                    h | ]	}|j         
S rC   r   r   s     rM   	<setcomp>z?DataFrameGroupBy._wrap_applied_output_series.<locals>.<setcomp>	  s    ,,,QV,,,rO   rS   r  r   r   rC   )_construct_axes_dictr-   r+   r   r   vstackr   r5  ri   r   r  iterru   r   tolistrg   r   r   r   r   )rL   r   r   r  r  r   rF   all_indexed_samestacked_valuesr   r   rK  r   r  s                @rM   r  z,DataFrameGroupBy._wrap_applied_output_series	  sx     4466!!&!!CCCCFCCC++D+DV+D+D+DDD 	''!%) (    #B#B6#B#B#BCC &++--<,,V,,,E5zzQ#DKK006))+2244N&&~UG&TT} 	90088F""48I">>>rO   r   r   rn   c                                           |          }d fd}|                    |          } j                            ||j                  }|S )Nrm   bvaluesr3   rH   c                0     j         j        d| dfi S )Nr   rS   )r   r   )r  r   rF   rL   s    rM   arr_funcz4DataFrameGroupBy._cython_transform.<locals>.arr_func	  s2    24=2Wc1 06  rO   re   )r  r3   rH   r3   )r{   r~   rg   rh   rf   )rL   r   rn   rF   rb   r  res_mgrr   s   `` `    rM   r   z"DataFrameGroupBy._cython_transform	  s     !77%C 8 
 
	 	 	 	 	 	 	 	
 ))H%%//gl/KKrO   c                |   t          |          r | j        |g|R d|i|S ddlm} g }| j        }| j                            |          }	 | j        |g|R i |\  }
}	 t          |	          \  }}t          
                    |d|           	 |                     |
||          \  }}n$# t          $ r}d}t          |          |d }~ww xY w|j        dk    r+t          | j        ||          }|                    |           n# t"          $ r Y nw xY w|	D ]c\  }}|j        dk    rt          
                    |d|            ||          }t          | j        ||          }|                    |           d|j        } ||ddd          }|                    |d	
          }|                     |          S )Nr   r   r   ri   z3transform must return a scalar value for each groupFT)r   rL  r   rS   r   )r/   r   r   r   rs   r   r   _define_pathsr  r   r   _choose_pathr  size_wrap_transform_general_framerg   r   StopIterationr   reindexr   )rL   r   r   r   rD   rF   r   appliedrg   gen	fast_path	slow_pathri   r   pathr   r   msgconcat_indexr   s                       rM   r   z#DataFrameGroupBy._transform_general	  sF   6"" 	-4-  +8<B   	655555'm((--1t1$HHHHHH	9
	$s))KD%
 ufd333/ --iEJJ	cc / / /K oo3./ zA~~3DHeSIIs###  	 	 	D	   	  	 KD%zQufd333$u++C/%EECNN3{v!e$
 
 
 $++Lq+AA--l;;;s*   !D B+ +
C5CC
DDa  
    >>> df = pd.DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',
    ...                           'foo', 'bar'],
    ...                    'B' : ['one', 'one', 'two', 'three',
    ...                           'two', 'two'],
    ...                    'C' : [1, 5, 5, 2, 5, 5],
    ...                    'D' : [2.0, 5., 8., 1., 2., 9.]})
    >>> grouped = df.groupby('A')[['C', 'D']]
    >>> grouped.transform(lambda x: (x - x.mean()) / x.std())
            C         D
    0 -1.154701 -0.577350
    1  0.577350  0.000000
    2  0.577350  1.154701
    3 -1.154701 -1.000000
    4  0.577350 -0.577350
    5  0.577350  1.000000

    Broadcast result of the transformation

    >>> grouped.transform(lambda x: x.max() - x.min())
        C    D
    0  4.0  6.0
    1  3.0  8.0
    2  4.0  6.0
    3  3.0  8.0
    4  4.0  6.0
    5  3.0  8.0

    >>> grouped.transform("mean")
        C    D
    0  3.666667  4.0
    1  4.000000  5.0
    2  3.666667  4.0
    3  4.000000  5.0
    4  3.666667  4.0
    5  4.000000  5.0

    The resulting dtype will reflect the return value of the passed ``func``,
    for example:

    >>> grouped.transform(lambda x: x.astype(int).max())
    C  D
    0  5  8
    1  5  9
    2  5  8
    3  5  9
    4  5  8
    5  5  9
    c               *     | j         |g|R ||d|S )a  
        Call function producing a same-indexed DataFrame on each group.

        Returns a DataFrame having the same indexes as the original object
        filled with the transformed values.

        Parameters
        ----------
        func : function, str
            Function to apply to each group.
            See the Notes section below for requirements.

            Accepted inputs are:

            - String
            - Python function
            - Numba JIT function with ``engine='numba'`` specified.

            Only passing a single function is supported with this engine.
            If the ``'numba'`` engine is chosen, the function must be
            a user defined function with ``values`` and ``index`` as the
            first and second arguments respectively in the function signature.
            Each group's index will be passed to the user defined function
            and optionally available for use.

            If a string is chosen, then it needs to be the name
            of the groupby method you want to use.
        *args
            Positional arguments to pass to func.
        engine : str, default None
            * ``'cython'`` : Runs the function through C-extensions from cython.
            * ``'numba'`` : Runs the function through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'``
              or the global 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 ``nopython``, ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nopython': True, 'nogil': False, 'parallel': False}`` and will be
              applied to the function

        **kwargs
            Keyword arguments to be passed into func.

        Returns
        -------
        DataFrame
            DataFrame with the same indexes as the original object filled
            with transformed values.

        See Also
        --------
        DataFrame.groupby.apply : Apply function ``func`` group-wise and combine
            the results together.
        DataFrame.groupby.aggregate : Aggregate using one or more operations.
        DataFrame.transform : Call ``func`` on self producing a DataFrame with the
            same axis shape as self.

        Notes
        -----
        Each group is endowed the attribute 'name' in case you need to know
        which group you are working on.

        The current implementation imposes three requirements on f:

        * f must return a value that either has the same shape as the input
          subframe or can be broadcast to the shape of the input subframe.
          For example, if `f` returns a scalar it will be broadcast to have the
          same shape as the input subframe.
        * if this is a DataFrame, f must support application column-by-column
          in the subframe. If f also supports application to the entire subframe,
          then a fast path is used starting from the second chunk.
        * f must not mutate groups. Mutation is not supported and may
          produce unexpected results. See :ref:`gotchas.udf-mutation` for more details.

        When using ``engine='numba'``, there will be no "fall back" behavior internally.
        The group data and group index will be passed as numpy arrays to the JITed
        user defined function, and no alternative execution attempts will be tried.

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

        .. versionchanged:: 2.0.0

            When using ``.transform`` on a grouped DataFrame
            and the transformation function returns a DataFrame,
            pandas now aligns the result's index with the input's index.
            You can call ``.to_numpy()`` on the result of the
            transformation function to avoid alignment.

        Examples
        --------

        >>> df = pd.DataFrame(
        ...     {
        ...         "A": ["foo", "bar", "foo", "bar", "foo", "bar"],
        ...         "B": ["one", "one", "two", "three", "two", "two"],
        ...         "C": [1, 5, 5, 2, 5, 5],
        ...         "D": [2.0, 5.0, 8.0, 1.0, 2.0, 9.0],
        ...     }
        ... )
        >>> grouped = df.groupby("A")[["C", "D"]]
        >>> grouped.transform(lambda x: (x - x.mean()) / x.std())
                  C         D
        0 -1.154701 -0.577350
        1  0.577350  0.000000
        2  0.577350  1.154701
        3 -1.154701 -1.000000
        4  0.577350 -0.577350
        5  0.577350  1.000000

        Broadcast result of the transformation

        >>> grouped.transform(lambda x: x.max() - x.min())
             C    D
        0  4.0  6.0
        1  3.0  8.0
        2  4.0  6.0
        3  3.0  8.0
        4  4.0  6.0
        5  3.0  8.0

        >>> grouped.transform("mean")
                  C    D
        0  3.666667  4.0
        1  4.000000  5.0
        2  3.666667  4.0
        3  4.000000  5.0
        4  3.666667  4.0
        5  4.000000  5.0

        The resulting dtype will reflect the return value of the passed ``func``,
        for example:

        >>> grouped.transform(lambda x: x.astype(int).max())
           C  D
        0  5  8
        1  5  9
        2  5  8
        3  5  9
        4  5  8
        5  5  9
        r   r   r   s         rM   r   zDataFrameGroupBy.transformV
  sB    d t

 
 &m
 
GM
 
 	
rO   c                t    t          t                    rfd}fd}nfd}fd}||fS )Nc                0     t          |           i S rK   r  r   rD   r   rF   s    rM   r   z0DataFrameGroupBy._define_paths.<locals>.<lambda>
  s!    &:geT&:&:D&KF&K&K rO   c                <    |                      fdd          S )Nc                0     t          |           i S rK   r  r   s    rM   r   zBDataFrameGroupBy._define_paths.<locals>.<lambda>.<locals>.<lambda>
  s!    *'!T**D;F;; rO   r   r  r  r!  s    rM   r   z0DataFrameGroupBy._define_paths.<locals>.<lambda>
  s.    ekk;;;;;;! '2 ' ' rO   c                     | gR i S rK   rC   r!  s    rM   r   z0DataFrameGroupBy._define_paths.<locals>.<lambda>
  s!    dd5&B4&B&B&B6&B&B rO   c                <    |                      fdd          S )Nc                     | gR i S rK   rC   r   s    rM   r   zBDataFrameGroupBy._define_paths.<locals>.<lambda>.<locals>.<lambda>
  s!    $$q24222622 rO   r   r  r  r!  s    rM   r   z0DataFrameGroupBy._define_paths.<locals>.<lambda>
  s.    ekk222222 '2 ' ' rO   )r   r   )rL   r   rD   rF   r  r  s    ```  rM   r  zDataFrameGroupBy._define_paths
  s    dC   		KKKKKKI     II CBBBBBI     I )##rO   r  r   r  r   c                   |} ||          }| j         dk    r||fS 	  ||          }n# t          $ r  t          $ r ||fcY S w xY wt          |t                    r$|j                            |j                  s||fS n=t          |t                    r$|j                            |j                  s||fS n||fS |                    |          r|}||fS r  )	r   r  	Exceptionr   r%   r   equalsr-   r   )rL   r  r  r   r  r   res_fasts          rM   r  zDataFrameGroupBy._choose_path
  s/   i<1 9	 y''HH 	 	 	 	 	 	 9	 h	** 	#**5=99 !Sy !&)) 	>((77 !Sy ! 9??3 	DSys   * AATr   c                6   g }| j         }| j                            |          }|D ]\  }}	t                              |	d|            ||	g|R i |}
	 |
                                }
n# t          $ r Y nw xY wt          |
          st          |
          rIt          |
          r:t          |
          r*|
r(|                    |                     |                     t          dt          |
          j         d          |                     ||          S )a  
        Filter elements from groups that don't satisfy a criterion.

        Elements from groups are filtered if they do not satisfy the
        boolean criterion specified by func.

        Parameters
        ----------
        func : function
            Criterion to apply to each group. Should return True or False.
        dropna : bool
            Drop groups that do not pass the filter. True by default; if False,
            groups that evaluate False are filled with NaNs.
        *args : tuple
            Additional positional arguments to pass to `func`.
        **kwargs : dict
            Additional keyword arguments to pass to `func`.

        Returns
        -------
        DataFrame
            The filtered subset of the original DataFrame.

        See Also
        --------
        DataFrame.filter: Filter elements of ungrouped DataFrame.
        SeriesGroupBy.filter : Filter elements from groups base on criterion.

        Notes
        -----
        Each subframe is endowed the attribute 'name' in case you need to know
        which group you are working on.

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

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "A": ["foo", "bar", "foo", "bar", "foo", "bar"],
        ...         "B": [1, 2, 3, 4, 5, 6],
        ...         "C": [2.0, 5.0, 8.0, 1.0, 2.0, 9.0],
        ...     }
        ... )
        >>> grouped = df.groupby("A")
        >>> grouped.filter(lambda x: x["B"].mean() > 3.0)
             A  B    C
        1  bar  2  5.0
        3  bar  4  1.0
        5  bar  6  9.0
        ri   zfilter function returned a z, but expected a scalar bool)r  r   r   r   r   squeezeAttributeErrorr   r   r   r   r   r
  rv   rw   rX   r  )rL   r   r   rD   rF   r  rg   r  ri   r   r   s              rM   r  zDataFrameGroupBy.filter  sP   l  m((-- 	 	KD% ufd333$u.t...v..Ckkmm!    s|| 	# 499 :: :# :NN4??4#8#8999  1$s))2D 1 1 1  
 !!'6222s   A))
A65A6 DataFrameGroupBy | SeriesGroupByc                    t          |t                    r"t          |          dk    rt          d          t	                                          |          S )NrS   zRCannot subset columns with a tuple with more than one element. Use a list instead.)r   r   r   r  r}   rW   )rL   rP   r   s     rM   rW   zDataFrameGroupBy.__getitem__q  sV    c5!! 	c#hhll &   ww""3'''rO   ndimrQ   c                   |dk    rP|| j         }t          || j        | j        | j        | j        || j        | j        | j        | j	        | j
                  S |dk    rV|| j         |         }t          || j        | j        | j        | j        || j        | j        | j        | j	        | j
                  S t          d          )a  
        sub-classes to define
        return a sliced object

        Parameters
        ----------
        key : string / list of selections
        ndim : {1, 2}
            requested ndim of result
        subset : object, default None
            subset to act on
        rT   N)	levelgrouper
exclusions	selectionr   r  r   observedr   rS   zinvalid ndim for _gotitem)rg   r  r   r2  r   r4  r   r  r   r6  r   ra   r  )rL   rP   r0  subsets       rM   _gotitemzDataFrameGroupBy._gotitem|  s     199~#	j?Y?{    QYY~# 	j?Y?{    8999rO   rm   ri   rp   r4   c               N    | j         }|j        }|r|                                }|S rK   )rs   rt   get_numeric_data)rL   rn   ri   rg   rb   s        rM   r{   z'DataFrameGroupBy._get_data_to_aggregate  s1     'h 	)&&((C
rO   rb   c                D    | j                             ||j                  S rd   )rg   rh   rf   )rL   rb   s     rM   rl   z$DataFrameGroupBy._wrap_agged_manager  s    x--c-AAArO   c                f    ddl m}  j        j        } fdt	          j                  D             }fd|D             }|st          g | j        j                  }n |||d          } j        s6t          t          |                    |_                             |          }|S )Nr   r   c              3     K   | ]9\  }}t          j        d d |f         |j        j        j                  V  :d S )N)r5  r3  r4  r6  )ra   r  r   r4  r6  )r   icolnamerg   rL   s      rM   r   z=DataFrameGroupBy._apply_to_column_groupbys.<locals>.<genexpr>  so       	
 	
 7 A!?  	
 	
 	
 	
 	
 	
rO   c                &    g | ]} |          S rC   rC   )r   sgbr   s     rM   r   z>DataFrameGroupBy._apply_to_column_groupbys.<locals>.<listcomp>  s!    ---4499---rO   r   r   rS   )r   r   )r   r   rs   r   r   r%   r   r   r   r,   r   r   r   )rL   r   r   r   sgbsr   r   rg   s   ``     @rM   _apply_to_column_groupbysz*DataFrameGroupBy._apply_to_column_groupbys  s    555555'+	
 	
 	
 	
 	
 (44	
 	
 	
 .------ 	;r7$-:TUUUFFVG':::F} 	9(V55FL0088FrO   c                4    |                      fd          S )a  
        Return DataFrame with counts of unique elements in each position.

        Parameters
        ----------
        dropna : bool, default True
            Don't include NaN in the counts.

        Returns
        -------
        nunique: DataFrame
            Counts of unique elements in each position.

        See Also
        --------
        DataFrame.nunique : Count number of distinct elements in specified axis.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "id": ["spam", "egg", "egg", "spam", "ham", "ham"],
        ...         "value1": [1, 5, 5, 2, 5, 5],
        ...         "value2": list("abbaxy"),
        ...     }
        ... )
        >>> df
             id  value1 value2
        0  spam       1      a
        1   egg       5      b
        2   egg       5      b
        3  spam       2      a
        4   ham       5      x
        5   ham       5      y

        >>> df.groupby("id").nunique()
              value1  value2
        id
        egg        1       1
        ham        1       2
        spam       2       1

        Check for rows with the same id but conflicting values:

        >>> df.groupby("id").filter(lambda g: (g.nunique() > 1).any())
             id  value1 value2
        0  spam       1      a
        3  spam       2      a
        4   ham       5      x
        5   ham       5      y
        c                .    |                                S rK   )r"  )rA  r   s    rM   r   z*DataFrameGroupBy.nunique.<locals>.<lambda>  s    #++f:M:M rO   )rD  )rL   r   s    `rM   r"  zDataFrameGroupBy.nunique  s$    h --.M.M.M.MNNNrO   r{  c                2    |                      d||          S )a  
        Return index of first occurrence of maximum in each group.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA values.
        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.

        Returns
        -------
        DataFrame
            Indexes of maxima in each column according to the group.

        Raises
        ------
        ValueError
            When there are no valid values for a group. Then can happen if:

                * There is an unobserved group and ``observed=False``.
                * All values for a group are NA.
                * Some values for a group are NA and ``skipna=False``.

        .. versionchanged:: 3.0.0
            Previously if all values for a group are NA or some values for a group are
            NA and ``skipna=False``, this method would return NA. Now it raises instead.

        See Also
        --------
        Series.idxmax : Return index of the maximum element.
        DataFrame.idxmax : Indexes of maxima along the specified axis.

        Notes
        -----
        This method is the DataFrame version of ``ndarray.argmax``.

        Examples
        --------
        Consider a dataset containing food consumption in Argentina.

        >>> df = pd.DataFrame(
        ...     {
        ...         "consumption": [10.51, 103.11, 55.48],
        ...         "co2_emissions": [37.2, 19.66, 1712],
        ...         "food_type": ["meat", "plant", "meat"],
        ...     },
        ...     index=["Pork", "Wheat Products", "Beef"],
        ... )

        >>> df
                        consumption  co2_emissions food_type
        Pork                  10.51         37.20       meat
        Wheat Products       103.11         19.66      plant
        Beef                  55.48       1712.00       meat

        By default, it returns the index for the maximum value in each column
        according to the group.

        >>> df.groupby("food_type").idxmax()
                      consumption   co2_emissions
        food_type
        meat                 Beef            Beef
        plant      Wheat Products  Wheat Products
        r  rn   r{  r  rL   r{  rn   s      rM   r  zDataFrameGroupBy.idxmax
       L ""8,v"VVVrO   c                2    |                      d||          S )a  
        Return index of first occurrence of minimum in each group.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA values.
        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.

        Returns
        -------
        DataFrame
            Indexes of minima in each column according to the group.

        Raises
        ------
        ValueError
            When there are no valid values for a group. Then can happen if:

                * There is an unobserved group and ``observed=False``.
                * All values for a group are NA.
                * Some values for a group are NA and ``skipna=False``.

        .. versionchanged:: 3.0.0
            Previously if all values for a group are NA or some values for a group are
            NA and ``skipna=False``, this method would return NA. Now it raises instead.

        See Also
        --------
        Series.idxmin : Return index of the minimum element.
        DataFrame.idxmin : Indexes of minima along the specified axis.

        Notes
        -----
        This method is the DataFrame version of ``ndarray.argmin``.

        Examples
        --------
        Consider a dataset containing food consumption in Argentina.

        >>> df = pd.DataFrame(
        ...     {
        ...         "consumption": [10.51, 103.11, 55.48],
        ...         "co2_emissions": [37.2, 19.66, 1712],
        ...         "food_type": ["meat", "plant", "meat"],
        ...     },
        ...     index=["Pork", "Wheat Products", "Beef"],
        ... )

        >>> df
                        consumption  co2_emissions food_type
        Pork                  10.51         37.20       meat
        Wheat Products       103.11         19.66      plant
        Beef                  55.48       1712.00       meat

        By default, it returns the index for the minimum value in each column
        according to the group.

        >>> df.groupby("food_type").idxmin()
                      consumption   co2_emissions
        food_type
        meat                 Pork            Pork
        plant      Wheat Products  Wheat Products
        r  rH  r  rI  s      rM   r  zDataFrameGroupBy.idxminR  rJ  rO   r7  Sequence[Hashable] | Noner(  r  r)  c                4    |                      |||||          S )aN  
        Return a Series or DataFrame containing counts of unique rows.

        Parameters
        ----------
        subset : list-like, optional
            Columns to use when counting unique combinations.
        normalize : bool, default False
            Return proportions rather than frequencies.
        sort : bool, default True
            Stable sort by frequencies when True. When False, non-grouping
            columns will appear in the order they occur in within groups.

            .. versionchanged:: 3.0.0

                In prior versions, ``sort=False`` would sort the non-grouping columns
                by label.
        ascending : bool, default False
            Sort in ascending order.
        dropna : bool, default True
            Don't include counts of rows that contain NA values.

        Returns
        -------
        Series or DataFrame
            Series if the groupby ``as_index`` is True, otherwise DataFrame.

        See Also
        --------
        Series.value_counts: Equivalent method on Series.
        DataFrame.value_counts: Equivalent method on DataFrame.
        SeriesGroupBy.value_counts: Equivalent method on SeriesGroupBy.

        Notes
        -----
        - If the groupby ``as_index`` is True then the returned Series will have a
          MultiIndex with one level per input column.
        - If the groupby ``as_index`` is False then the returned DataFrame will have an
          additional column with the value_counts. The column is labelled 'count' or
          'proportion', depending on the ``normalize`` parameter.

        By default, rows that contain any NA values are omitted from
        the result.

        By default, the result will be in descending order so that the
        first element of each group is the most frequently-occurring row.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "gender": ["male", "male", "female", "male", "female", "male"],
        ...         "education": ["low", "medium", "high", "low", "high", "low"],
        ...         "country": ["US", "FR", "US", "FR", "FR", "FR"],
        ...     }
        ... )

        >>> df
                gender  education   country
        0       male    low         US
        1       male    medium      FR
        2       female  high        US
        3       male    low         FR
        4       female  high        FR
        5       male    low         FR

        >>> df.groupby("gender").value_counts()
        gender  education  country
        female  high       US         1
                           FR         1
        male    low        FR         2
                           US         1
                medium     FR         1
        Name: count, dtype: int64

        >>> df.groupby("gender").value_counts(ascending=True)
        gender  education  country
        female  high       US         1
                           FR         1
        male    low        US         1
                medium     FR         1
                low        FR         2
        Name: count, dtype: int64

        >>> df.groupby("gender").value_counts(normalize=True)
        gender  education  country
        female  high       US         0.50
                           FR         0.50
        male    low        FR         0.50
                           US         0.25
                medium     FR         0.25
        Name: proportion, dtype: float64

        >>> df.groupby("gender", as_index=False).value_counts()
           gender education country  count
        0  female      high      US      1
        1  female      high      FR      1
        2    male       low      FR      2
        3    male       low      US      1
        4    male    medium      FR      1

        >>> df.groupby("gender", as_index=False).value_counts(normalize=True)
           gender education country  proportion
        0  female      high      US        0.50
        1  female      high      FR        0.50
        2    male       low      FR        0.50
        3    male       low      US        0.25
        4    male    medium      FR        0.25
        )rM  )rL   r7  r(  r  r)  r   s         rM   rQ  zDataFrameGroupBy.value_counts  s!    j !!&)T9fMMMrO   r  r9   c                $     | j         dd|i|}|S )a$  
        Return the elements in the given *positional* indices in each group.

        This means that we are not indexing according to actual values in
        the index attribute of the object. We are indexing according to the
        actual position of the element in the object.

        If a requested index does not exist for some group, this method will raise.
        To get similar behavior that ignores indices that don't exist, see
        :meth:`.DataFrameGroupBy.nth`.

        Parameters
        ----------
        indices : array-like
            An array of ints indicating which positions to take.

        **kwargs
            For compatibility with :meth:`numpy.take`. Has no effect on the
            output.

        Returns
        -------
        DataFrame
            A DataFrame containing the elements taken from each group.

        See Also
        --------
        DataFrame.take : Take elements from a Series along an axis.
        DataFrame.loc : Select a subset of a DataFrame by labels.
        DataFrame.iloc : Select a subset of a DataFrame by positions.
        numpy.take : Take elements from an array along an axis.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     [
        ...         ("falcon", "bird", 389.0),
        ...         ("parrot", "bird", 24.0),
        ...         ("lion", "mammal", 80.5),
        ...         ("monkey", "mammal", np.nan),
        ...         ("rabbit", "mammal", 15.0),
        ...     ],
        ...     columns=["name", "class", "max_speed"],
        ...     index=[4, 3, 2, 1, 0],
        ... )
        >>> df
             name   class  max_speed
        4  falcon    bird      389.0
        3  parrot    bird       24.0
        2    lion  mammal       80.5
        1  monkey  mammal        NaN
        0  rabbit  mammal       15.0
        >>> gb = df.groupby([1, 1, 2, 2, 2])

        Take elements at rows 0 and 1.

        Note how the indices selected in the result do not correspond to
        our input indices 0 and 1. That's because we are selecting the 0th
        and 1st rows, not rows whose indices equal 0 and 1.

        >>> gb.take([0, 1])
               name   class  max_speed
        1 4  falcon    bird      389.0
          3  parrot    bird       24.0
        2 2    lion  mammal       80.5
          1  monkey  mammal        NaN

        The order of the specified indices influences the order in the result.
        Here, the order is swapped from the previous example.

        >>> gb.take([1, 0])
               name   class  max_speed
        1 3  parrot    bird       24.0
          4  falcon    bird      389.0
        2 1  monkey  mammal        NaN
          2    lion  mammal       80.5

        We may take elements using negative integers for positive indices,
        starting from the end of the object, just like with Python lists.

        >>> gb.take([-1, -2])
               name   class  max_speed
        1 3  parrot    bird       24.0
          4  falcon    bird      389.0
        2 0  rabbit  mammal       15.0
          1  monkey  mammal        NaN
        rS  r  rw  rx  rz  s       rM   rS  zDataFrameGroupBy.take  s'    x $#FFGFvFFrO   c                ,    d } | j         	 d|||d|S )a  
        Return unbiased skew within groups.

        Normalized by N-1.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA/null values when computing the result.

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

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

        Returns
        -------
        DataFrame
            Unbiased skew within groups.

        See Also
        --------
        DataFrame.skew : Return unbiased skew over requested axis.

        Examples
        --------
        >>> arrays = [
        ...     ["falcon", "parrot", "cockatoo", "kiwi", "lion", "monkey", "rabbit"],
        ...     ["bird", "bird", "bird", "bird", "mammal", "mammal", "mammal"],
        ... ]
        >>> index = pd.MultiIndex.from_arrays(arrays, names=("name", "class"))
        >>> df = pd.DataFrame(
        ...     {"max_speed": [389.0, 24.0, 70.0, np.nan, 80.5, 21.5, 15.0]},
        ...     index=index,
        ... )
        >>> df
                        max_speed
        name     class
        falcon   bird        389.0
        parrot   bird         24.0
        cockatoo bird         70.0
        kiwi     bird          NaN
        lion     mammal       80.5
        monkey   mammal       21.5
        rabbit   mammal       15.0
        >>> gb = df.groupby(["class"])
        >>> gb.skew()
                max_speed
        class
        bird     1.628296
        mammal   1.669046
        >>> gb.skew(skipna=False)
                max_speed
        class
        bird          NaN
        mammal   1.669046
        c                0    t          d| j                   )Nz"'skew' is not supported for dtype=r  r  s    rM   r  z"DataFrameGroupBy.skew.<locals>.alt  r  rO   r}  r~  r  r  r  s        rM   r}  zDataFrameGroupBy.skewr  sJ    B	N 	N 	N
 (t'
F
 
IO
 
 	
rO   c                &     | j         	 dd||d|S )a
  
        Return unbiased kurtosis within groups.

        Parameters
        ----------
        skipna : bool, default True
            Exclude NA/null values when computing the result.

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

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

        Returns
        -------
        DataFrame
            Unbiased kurtosis within groups.

        See Also
        --------
        DataFrame.kurt : Return unbiased kurtosis over requested axis.

        Examples
        --------
        >>> arrays = [
        ...     [
        ...         "falcon",
        ...         "parrot",
        ...         "cockatoo",
        ...         "kiwi",
        ...         "eagle",
        ...         "lion",
        ...         "monkey",
        ...         "rabbit",
        ...         "dog",
        ...         "wolf",
        ...     ],
        ...     [
        ...         "bird",
        ...         "bird",
        ...         "bird",
        ...         "bird",
        ...         "bird",
        ...         "mammal",
        ...         "mammal",
        ...         "mammal",
        ...         "mammal",
        ...         "mammal",
        ...     ],
        ... ]
        >>> index = pd.MultiIndex.from_arrays(arrays, names=("name", "class"))
        >>> df = pd.DataFrame(
        ...     {
        ...         "max_speed": [
        ...             389.0,
        ...             24.0,
        ...             70.0,
        ...             np.nan,
        ...             350.0,
        ...             80.5,
        ...             21.5,
        ...             15.0,
        ...             40.0,
        ...             50.0,
        ...         ]
        ...     },
        ...     index=index,
        ... )
        >>> df
                         max_speed
        name     class
        falcon   bird        389.0
        parrot   bird         24.0
        cockatoo bird         70.0
        kiwi     bird          NaN
        eagle    bird        350.0
        lion     mammal       80.5
        monkey   mammal       21.5
        rabbit   mammal       15.0
        dog      mammal       40.0
        wolf     mammal       50.0
        >>> gb = df.groupby(["class"])
        >>> gb.kurt()
                max_speed
        class
        bird    -5.493277
        mammal   0.204125
        >>> gb.kurt(skipna=False)
                max_speed
        class
        bird          NaN
        mammal   0.204125
        r  Nr~  r  r  r  s       rM   r  zDataFrameGroupBy.kurt  s8    J (t'
V,
 
JP
 
 	
rO   r(   c                $    t          |           }|S )ao  
        Make plots of groups from a DataFrame.

        Uses the backend specified by the option ``plotting.backend``.
        By default, matplotlib is used.

        Returns
        -------
        GroupByPlot
            A plotting object that can be used to create plots for each group.

        See Also
        --------
        DataFrame.plot : Make plots of DataFrame.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {"A": [1, 2, 3, 4], "B": [5, 6, 7, 8]}, index=["a", "a", "b", "b"]
        ... )
        >>> g = df.groupby(level=0)
        >>> g.plot()  # doctest: +SKIP
        r  r  s     rM   r  zDataFrameGroupBy.plot%  s    2 T""rO   r  rS   r   /str | Callable[[np.ndarray, np.ndarray], float]r  c                8    |                      d|||          }|S )a
  
        Compute pairwise correlation of columns, excluding NA/null values.

        Parameters
        ----------
        method : {'pearson', 'kendall', 'spearman'} or callable
            Method of correlation:

            * pearson : standard correlation coefficient
            * kendall : Kendall Tau correlation coefficient
            * spearman : Spearman rank correlation
            * callable: callable with input two 1d ndarrays
                and returning a float. Note that the returned matrix from corr
                will have 1 along the diagonals and will be symmetric
                regardless of the callable's behavior.
        min_periods : int, optional
            Minimum number of observations required per pair of columns
            to have a valid result. Currently only available for Pearson
            and Spearman correlation.
        numeric_only : bool, default False
            Include only `float`, `int` or `boolean` data.

            .. versionchanged:: 2.0.0
                The default value of ``numeric_only`` is now ``False``.

        Returns
        -------
        DataFrame
            Correlation matrix.

        See Also
        --------
        DataFrame.corrwith : Compute pairwise correlation with another
            DataFrame or Series.
        Series.corr : Compute the correlation between two Series.

        Notes
        -----
        Pearson, Kendall and Spearman correlation are currently computed using
        pairwise complete observations.

        * `Pearson correlation coefficient <https://en.wikipedia.org/wiki/Pearson_correlation_coefficient>`_
        * `Kendall rank correlation coefficient <https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient>`_
        * `Spearman's rank correlation coefficient <https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient>`_

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "age": [2, 3, 4, 6, 6, 1, 2, 1],
        ...         "weight": [2.1, 3.2, 4.1, 6.5, 3.3, 2.1, 4.1, 1.9],
        ...         "pet": ["dog", "cat", "dog", "cat", "dog", "cat", "dog", "cat"],
        ...     }
        ... )
        >>> df
           age  weight  pet
        0    2     2.1  dog
        1    3     3.2  cat
        2    4     4.1  dog
        3    6     6.5  cat
        4    6     3.3  dog
        5    1     2.1  cat
        6    2     4.1  dog
        7    1     1.9  cat
        >>> df.groupby("pet").corr()
                         age    weight
        pet
        cat age     1.000000  0.989321
            weight  0.989321  1.000000
        dog age     1.000000  0.184177
            weight  0.184177  1.000000
        r  )r   r  rn   rx  )rL   r   r  rn   r   s        rM   r  zDataFrameGroupBy.corrA  s/    \ ##6{ $ 
 
 rO   r  r  c                8    |                      d|||          }|S )a  
        Compute pairwise covariance of columns, excluding NA/null values.

        Compute the pairwise covariance among the series of a DataFrame.
        The returned data frame is the `covariance matrix
        <https://en.wikipedia.org/wiki/Covariance_matrix>`__ of the columns
        of the DataFrame.

        Both NA and null values are automatically excluded from the
        calculation. (See the note below about bias from missing values.)
        A threshold can be set for the minimum number of
        observations for each value created. Comparisons with observations
        below this threshold will be returned as ``NaN``.

        This method is generally used for the analysis of time series data to
        understand the relationship between different measures
        across time.

        Parameters
        ----------
        min_periods : int, optional
            Minimum number of observations required per pair of columns
            to have a valid result.

        ddof : int, default 1
            Delta degrees of freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.
            This argument is applicable only when no ``nan`` is in the dataframe.

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

            .. versionchanged:: 2.0.0
                The default value of ``numeric_only`` is now ``False``.

        Returns
        -------
        DataFrame
            The covariance matrix of the series of the DataFrame.

        See Also
        --------
        Series.cov : Compute covariance with another Series.
        core.window.ewm.ExponentialMovingWindow.cov : Exponential weighted sample
            covariance.
        core.window.expanding.Expanding.cov : Expanding sample covariance.
        core.window.rolling.Rolling.cov : Rolling sample covariance.

        Notes
        -----
        Returns the covariance matrix of the DataFrame's time series.
        The covariance is normalized by N-ddof.

        For DataFrames that have Series that are missing data (assuming that
        data is `missing at random
        <https://en.wikipedia.org/wiki/Missing_data#Missing_at_random>`__)
        the returned covariance matrix will be an unbiased estimate
        of the variance and covariance between the member Series.

        However, for many applications this estimate may not be acceptable
        because the estimate covariance matrix is not guaranteed to be positive
        semi-definite. This could lead to estimate correlations having
        absolute values which are greater than one, and/or a non-invertible
        covariance matrix. See `Estimation of covariance matrices
        <https://en.wikipedia.org/w/index.php?title=Estimation_of_covariance_
        matrices>`__ for more details.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {
        ...         "age": [2, 3, 4, 6, 6, 1, 2, 1],
        ...         "weight": [2.1, 3.2, 4.1, 6.5, 3.3, 2.1, 4.1, 1.9],
        ...         "pet": ["dog", "cat", "dog", "cat", "dog", "cat", "dog", "cat"],
        ...     }
        ... )
        >>> df
           age  weight  pet
        0    2     2.1  dog
        1    3     3.2  cat
        2    4     4.1  dog
        3    6     6.5  cat
        4    6     3.3  dog
        5    1     2.1  cat
        6    2     4.1  dog
        7    1     1.9  cat
        >>> df.groupby("pet").cov()
                         age    weight
        pet
        cat age     5.583333  4.975000
            weight  4.975000  4.529167
        dog age     3.666667  0.333333
            weight  0.333333  0.893333
        r  )r  r  rn   rx  )rL   r  r  rn   r   s        rM   r  zDataFrameGroupBy.cov  s/    H ##{L $ 
 
 rO   r  rA   IndexLabel | Noner  r  r  r  r  r  sharexshareyr  r  layouttuple[int, int] | Noner/  r  r  r  c                B     | j         	 d|||||||||	|
|||||d|}|S )a  
        Make a histogram of the DataFrame's columns.

        A `histogram`_ is a representation of the distribution of data.
        This function calls :meth:`matplotlib.pyplot.hist`, on each series in
        the DataFrame, resulting in one histogram per column.

        .. _histogram: https://en.wikipedia.org/wiki/Histogram

        Parameters
        ----------
        column : str or sequence, optional
            If passed, will be used to limit data to a subset of columns.
        by : object, optional
            If passed, then used to form histograms for separate groups.
        grid : bool, default True
            Whether to show axis grid lines.
        xlabelsize : int, default None
            If specified changes the x-axis label size.
        xrot : float, default None
            Rotation of x axis labels. For example, a value of 90 displays the
            x labels rotated 90 degrees clockwise.
        ylabelsize : int, default None
            If specified changes the y-axis label size.
        yrot : float, default None
            Rotation of y axis labels. For example, a value of 90 displays the
            y labels rotated 90 degrees clockwise.
        ax : Matplotlib axes object, default None
            The axes to plot the histogram on.
        sharex : bool, default True if ax is None else False
            In case subplots=True, share x axis and set some x axis labels to
            invisible; defaults to True if ax is None otherwise False if an ax
            is passed in.
            Note that passing in both an ax and sharex=True will alter all x axis
            labels for all subplots in a figure.
        sharey : bool, default False
            In case subplots=True, share y axis and set some y axis labels to
            invisible.
        figsize : tuple, optional
            The size in inches of the figure to create. Uses the value in
            `matplotlib.rcParams` by default.
        layout : tuple, optional
            Tuple of (rows, columns) for the layout of the histograms.
        bins : int or sequence, default 10
            Number of histogram bins to be used. If an integer is given, bins + 1
            bin edges are calculated and returned. If bins is a sequence, gives
            bin edges, including left edge of first bin and right edge of last
            bin. In this case, bins is returned unmodified.

        backend : str, default None
            Backend to use instead of the backend specified in the option
            ``plotting.backend``. For instance, 'matplotlib'. Alternatively, to
            specify the ``plotting.backend`` for the whole session, set
            ``pd.options.plotting.backend``.

        legend : bool, default False
            Whether to show the legend.

        **kwargs
            All other plotting keyword arguments to be passed to
            :meth:`matplotlib.pyplot.hist`.

        Returns
        -------
        matplotlib.Axes or numpy.ndarray
            A ``matplotlib.Axes`` object or an array of ``Axes`` objects, depending on
            the layout and grouping.

        See Also
        --------
        matplotlib.pyplot.hist : Plot a histogram using matplotlib.

        Examples
        --------
        This example draws a histogram based on the length and width of
        some animals, displayed in three bins

        .. plot::
            :context: close-figs

            >>> data = {
            ...     "length": [1.5, 0.5, 1.2, 0.9, 3],
            ...     "width": [0.7, 0.2, 0.15, 0.2, 1.1],
            ... }
            >>> index = ["pig", "rabbit", "duck", "chicken", "horse"]
            >>> df = pd.DataFrame(data, index=index)
            >>> hist = df.groupby("length").hist(bins=3)
        r  )rA   r  r  r  r  r  r  r  rW  rX  r  rY  r/  r  r  r  rx  )rL   rA   r  r  r  r  r  r  r  rW  rX  r  rY  r/  r  r  rF   r   s                     rM   r  zDataFrameGroupBy.hist  sd    V $#
!!!
 
" #
 
& rO   r  dropr5   c                    t          j        dt          t                                 |                     d||||          }|S )aO  
        Compute pairwise correlation.

        .. deprecated:: 3.0.0

        Pairwise correlation is computed between rows or columns of
        DataFrame with rows or columns of Series or DataFrame. DataFrames
        are first aligned along both axes before computing the
        correlations.

        Parameters
        ----------
        other : DataFrame, Series
            Object with which to compute correlations.
        drop : bool, default False
            Drop missing indices from result.
        method : {'pearson', 'kendall', 'spearman'} or callable
            Method of correlation:

            * pearson : standard correlation coefficient
            * kendall : Kendall Tau correlation coefficient
            * spearman : Spearman rank correlation
            * callable: callable with input two 1d ndarrays
                and returning a float.

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

            .. versionchanged:: 2.0.0
                The default value of ``numeric_only`` is now ``False``.

        Returns
        -------
        Series
            Pairwise correlations.

        See Also
        --------
        DataFrame.corr : Compute pairwise correlation of columns.

        Examples
        --------
        >>> df1 = pd.DataFrame(
        ...     {
        ...         "Day": [1, 1, 1, 2, 2, 2, 3, 3, 3],
        ...         "Data": [6, 6, 8, 5, 4, 2, 7, 3, 9],
        ...     }
        ... )
        >>> df2 = pd.DataFrame(
        ...     {
        ...         "Day": [1, 1, 1, 2, 2, 2, 3, 3, 3],
        ...         "Data": [5, 3, 8, 3, 1, 1, 2, 3, 6],
        ...     }
        ... )

        >>> df1.groupby("Day").corrwith(df2)
                 Data  Day
        Day
        1    0.917663  NaN
        2    0.755929  NaN
        3    0.576557  NaN
        z'DataFrameGroupBy.corrwith is deprecated)
stacklevelcorrwith)r  r\  r   rn   )warningswarnr   r   ry  )rL   r  r\  r   rn   r   s         rM   r_  zDataFrameGroupBy.corrwith}  s_    J 	5'))	
 	
 	
 	

 ##% $ 
 
 rO   rK   r  r  )r   r%   r   r   r   ro   r   ro   )
r   r  r   ro   r  r  r   ro   rH   r   r  )r   r   rn   ro   rH   r%   )r  r   r  r   r   r%   r  )r   ro   rH   r%   )rH   r.  )r0  rQ   )rn   ro   ri   rp   rH   r4   )rb   r4   rH   r%   r  )r{  ro   rn   ro   rH   r%   )NFTFT)r7  rL  r(  ro   r  ro   r)  ro   r   ro   rH   r   )r  r9   rH   r%   r  )r  rS   F)r   rS  r  rQ   rn   ro   rH   r%   )NrS   F)r  r  r  r  rn   ro   rH   r%   )NNTNNNNNFFNNr  NF)rA   rV  r  ro   r  r  r  r  r  r  r  r  rW  ro   rX  ro   r  r  rY  rZ  r/  r  r  rp   r  ro   )Fr  F)
r  r   r\  ro   r   r5   rn   ro   rH   r%   )&rX   rY   rZ   r   r  r   r  r   r  r   r   r   )_DataFrameGroupBy__examples_dataframe_docr   r  r  r  rW   r8  r{   rl   rD  r"  r  r  r0   boxplotrQ  rS  r}  r  r  r  r  r  r  r_  r  r  s   @rM   r  r  <  s       xT x x x x xt C1 1 1.   * "'"I I I I IV*? *? *? *?^ #    .0< 0< 0<d  &v0	2  2 h -1 T
 T
 T
 T
 T
l$ $ $" " " "HR3 R3 R3 R3 R3h	( 	( 	( 	( 	( 	(.: .: .: .: .:b ',     B B B B   84O 4O 4O 4O 4Op "FW FW FW FW FWT "FW FW FW FW FWP $G -1uN uN uN uN uNn] ] ] ]B "H
 H
 H
 H
 H
X "g
 g
 g
 g
 g
R    X: CL"	Q Q Q Q Qj #'"	g g g g gV %)!%!!%!.2)-$&"!~ ~ ~ ~ ~F $-"Q Q Q Q Q Q Q Q QrO   r  rg   r%   r   r   r   rH   c                `   ddl m} t          |t                    r|j                            | j                  r= ||gt          |j                  z  dd          }|j        |_        |j        |_        nN|                     t          j
        |j        t          |j                  df          |j        |j                  }t          |t                    sJ |S t          |t                    r:|j                            |j                  s|                    |          d         S |S )Nr   r   rS   T)r   r   rB  )r>   r   r   r-   r   is_r   r   r   r   rc  r   r%   _align_frame)rg   r   r   r   	res_frames        rM   r  r    s(    #v  9==## 		us5='9'99PTUUUI %I#kIOO((
S%5%5q$9::k )  I
 )Y/////	C	#	# CIMM%+,F,F &&q))
rO   )rg   r%   r   r%   r   r   rH   r%   )gr[   
__future__r   collectionsr   collections.abcr   r]   	functoolsr   textwrapr   typingr   r	   r
   r   r   r   r`  numpyr   pandas._libsr   pandas._libs.hashtabler   pandas.errorsr   r   pandas.util._decoratorsr   pandas.util._exceptionsr   pandas.core.dtypes.commonr   r   r   r   r   r   r   pandas.core.dtypes.dtypesr   r   pandas.core.dtypes.inferencer   pandas.core.dtypes.missingr   r   pandas.corer    pandas.core.applyr!   r"   r#   r$   pandas.core.commoncorecommonr   pandas.core.framer%   pandas.core.groupbyr&   pandas.core.groupby.groupbyr'   r(   pandas.core.indexes.apir)   r*   r+   r,   pandas.core.seriesr-   pandas.core.sortingr.   pandas.core.util.numba_r/   pandas.plottingr0   r1   r2   pandas._typingr3   r4   r5   r6   r7   r8   r9   r>   r:   pandas.core.genericr;   r   r<   r\   r=   	dataclassr@   ra   r  r  rC   rO   rM   <module>r     sG     # " " " " "       $ $ $ $ $ $                                     ! ! ! ! ! ! - - - - - -        / . . . . . 4 4 4 4 4 4                         5 4 4 4 4 4       
 # " " " " "            !                 ' ' ' ' ' ' $ $ $ $ $ $                   & % % % % % / / / / / / 3 3 3 3 3 3 1 1 1 1 1 1 ,       
                  #"""""++++++ Xc3h//	 / / / / w~&& HJ/ J/ J/ J/ J/ J/ J/  J/Z   | | | | |GFO | | ! |~;   Q Q Q Q Qwy) Q Q ! Qh<     rO   