Sindbad~EG File Manager
�
MٜgZ� � � � d Z ddlmZ ddlZddlZddlmZmZmZm Z ddl
Zddlm
Z
mZ ddlmc mZ ddlmZmZmZmZmZ ddlmZ ddlmZ dd lmZmZ dd
l m!Z!m"Z"m#Z#m$Z$m%Z% ddl&m'Z'm(Z( ddl)m*Z* dd
l+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z: erddl;m<Z<m=Z=m>Z> ddl?m@Z@ d$d�ZAd� ZB G d� d� ZC G d� d� ZD G d� deD� ZEd%d�ZF G d� dee � ZG G d� deG� ZH G d � d!eG� ZIdd"� d&d#�ZJy)'a
Provide classes to perform the groupby aggregate operations.
These are not exposed to the user and provide implementations of the grouping
operations, primarily in cython. These classes (BaseGrouper and BinGrouper)
are contained *in* the SeriesGroupBy and DataFrameGroupBy objects.
� )�annotationsN)�
TYPE_CHECKING�Callable�Generic�final)�NaT�lib)� ArrayLike�AxisInt�NDFrameT�Shape�npt��AbstractMethodError)�cache_readonly)�maybe_cast_pointwise_result�maybe_downcast_to_dtype)�ensure_float64�ensure_int64�ensure_platform_int�
ensure_uint64�is_1d_only_ea_dtype)�isna�
maybe_fill)� DataFrame)�grouper)�CategoricalIndex�Index�
MultiIndex�ensure_index)�Series)�compress_group_index�decons_obs_group_ids�get_flattened_list�get_group_index�get_group_index_sorter�get_indexer_dict)�Hashable�Iterator�Sequence)�NDFramec �b � t | t j � r|t k7 rt d� �y y )NzMust produce aggregated value)�
isinstance�np�ndarray�object�
ValueError)�obj�dtypes �B/usr/local/lib/python3.12/site-packages/pandas/core/groupby/ops.py�check_result_arrayr5 P s1 � � �#�r�z�z�"��F�?� �<�=�=� � #� c �z � t | d� r.| j } | j dk( rt | � dk( r| d } | S )zb
Extract the result object, it might be a 0-dim ndarray
or a len-1 0-dim, or a scalar
�_values� r )�hasattrr8 �ndim�len)�ress r4 �extract_resultr>