+
    xȇi$                        ^ RI Ht ^ RIHt ^ RIHtHtHt ^ RIt	^ RI
HtHt ^ RIHtHt ]'       d   ^ RIHt ^ RIHtHt ^ R	IHt  ! R
 R4      t]! ]P0                  4       ! R R4      4       t ! R R4      tR# )    )annotations)Iterable)TYPE_CHECKINGLiteralcastN)cache_readonlydoc)
is_integeris_list_like)PositionalIndexer)	DataFrameSeries)groupbyc                      ] tR t^ tRt]R R l4       tR R ltR R ltR R	 lt	R
 R lt
R R lt]R R l4       t]R R l4       tRtR# )GroupByIndexingMixinz4
Mixin for adding ._positional_selector to GroupBy.
c                   V ^8  d   QhRR/# )   returnGroupByPositionalSelector )formats   "l/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/core/groupby/indexing.py__annotate__!GroupByIndexingMixin.__annotate__&   s     S7 S7&? S7    c                j    \         '       d   \        \        P                  V 4      pMT p\	        V4      # )a  
Return positional selection for each group.

``groupby._positional_selector[i:j]`` is similar to
``groupby.apply(lambda x: x.iloc[i:j])``
but much faster and preserves the original index and order.

``_positional_selector[]`` is compatible with and extends :meth:`~GroupBy.head`
and :meth:`~GroupBy.tail`. For example:

- ``head(5)``
- ``_positional_selector[5:-5]``
- ``tail(5)``

together return all the rows.

Allowed inputs for the index are:

- An integer valued iterable, e.g. ``range(2, 4)``.
- A comma separated list of integers and slices, e.g. ``5``, ``2, 4``, ``2:4``.

The output format is the same as :meth:`~GroupBy.head` and
:meth:`~GroupBy.tail`, namely
a subset of the ``DataFrame`` or ``Series`` with the index and order preserved.

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

See Also
--------
DataFrame.iloc : Purely integer-location based indexing for selection by
    position.
GroupBy.head : Return first n rows of each group.
GroupBy.tail : Return last n rows of each group.
GroupBy.nth : Take the nth row from each group if n is an int, or a
    subset of rows, if n is a list of ints.

Notes
-----
- The slice step cannot be negative.
- If the index specification results in overlaps, the item is not duplicated.
- If the index specification changes the order of items, then
  they are returned in their original order.
  By contrast, ``DataFrame.iloc`` can change the row order.
- ``groupby()`` parameters such as as_index and dropna are ignored.

The differences between ``_positional_selector[]`` and :meth:`~GroupBy.nth`
with ``as_index=False`` are:

- Input to ``_positional_selector`` can include
  one or more slices whereas ``nth``
  just handles an integer or a list of integers.
- ``_positional_selector`` can  accept a slice relative to the
  last row of each group.
- ``_positional_selector`` does not have an equivalent to the
  ``nth()`` ``dropna`` parameter.

Examples
--------
>>> df = pd.DataFrame(
...     [["a", 1], ["a", 2], ["a", 3], ["b", 4], ["b", 5]], columns=["A", "B"]
... )
>>> df.groupby("A")._positional_selector[1:2]
   A  B
1  a  2
4  b  5

>>> df.groupby("A")._positional_selector[1, -1]
   A  B
1  a  2
2  a  3
4  b  5
)r   r   r   GroupByr   selfgroupby_selfs   & r   _positional_selector)GroupByIndexingMixin._positional_selector%   s*    ^ =6LL(66r   c                    V ^8  d   QhRRRR/# )r   argPositionalIndexer | tupler   
np.ndarrayr   )r   s   "r   r   r   {   s     & &&& 
&r   c                	   \        V4      '       d   \        ;QJ d*    R  \        \        V4       4       F  '       d   K   RM	  RM! R  \        \        V4       4       4      '       d,   V P	                  \        \        \
        ,          V4      4      pMV P                  \        \        V4      4      pMq\        V\        4      '       d   V P                  V4      pMI\        V4      '       d!   V P                  \        \
        V4      4      pM\        R\        V4       R24      h\        V\        4      '       d(   V'       d   V P                   ^ 8  pMV P                   ^ 8  p\        \"        P$                  V4      # )c              3  8   "   T F  p\        V4      x  K  	  R # 5iN)r
   ).0is   & r   	<genexpr>JGroupByIndexingMixin._make_mask_from_positional_indexer.<locals>.<genexpr>   s     >*=Q:a==*=s   FTzInvalid index zE. Must be integer, list-like, slice or a tuple of integers and slices)r   allr   r   _make_mask_from_listint_make_mask_from_tupletuple
isinstanceslice_make_mask_from_slicer
   _make_mask_from_int	TypeErrortypebool_ascending_countnpndarrayr   r$   masks   && r   "_make_mask_from_positional_indexer7GroupByIndexingMixin._make_mask_from_positional_indexer{   s    s>$x*=>sss>$x*=>>>00hsmS1IJ11$uc2BCU##--c2D__++DcN;D c ,& &  dD!!,,1,,q0BJJ%%r   c                    V ^8  d   QhRRRR/# )r   r$   r0   r   r&   r   )r   s   "r   r   r      s     8 8s 8z 8r   c                	\    V^ 8  d   V P                   V8H  # V P                  V) ^,
          8H  # )r   )r:   _descending_count)r   r$   s   &&r   r6   (GroupByIndexingMixin._make_mask_from_int   s1    !8((C//))sdQh77r   c                    V ^8  d   QhRRRR/# )r   argszIterable[int]r   bool | np.ndarrayr   )r   s   "r   r   r      s       ;L r   c                	R   V Uu. uF  q"^ 8  g   K  VNK  	  ppV Uu. uF  q"^ 8  g   K  V) ^,
          NK  	  ppRpV'       d)   V\         P                  ! V P                  V4      ,          pV'       d)   V\         P                  ! V P                  V4      ,          pV# u upi u upi )r   F)r;   isinr:   rC   )r   rF   r$   positivenegativer>   s   &&    r   r/   )GroupByIndexingMixin._make_mask_from_list   s    #'44C!8CC44(,8aHSD1HH8"'BGGD118<<DBGGD22H==D 58s   BBB$B$c                    V ^8  d   QhRRRR/# )r   rF   r2   r   rG   r   )r   s   "r   r   r      s      % 4E r   c                	   R pV F  p\        V4      '       d(   W P                  \        \        V4      4      ,          pK;  \	        V\
        4      '       d   W P                  V4      ,          pKj  \        R\        V4       R24      h	  V# )FzInvalid argument z. Should be int or slice.)	r
   r6   r   r0   r3   r4   r5   
ValueErrorr8   )r   rF   r>   r$   s   &&  r   r1   *GroupByIndexingMixin._make_mask_from_tuple   sx    "'C#00c3@@C''22377 'S	{2KL   r   c                    V ^8  d   QhRRRR/# )r   r$   r4   r   rG   r   )r   s   "r   r   r      s     ( ( (3D (r   c                	   VP                   pVP                  pVP                  pVe   V^ 8  d   \        RV R24      hRpVf   ^pVf%   V^8  d   WPP                  V,          ^ 8H  ,          pMV^ 8  dA   WPP                  V8  ,          pV^8  d$   WPP                  V,
          V,          ^ 8H  ,          pMWPP
                  V) 8  ,          pV P
                  V,           ^,           pV P                  V P
                  ,           V^,           ,           ^ 8  p\        P                  ! WpP                  V4      pWVV,          ^ 8H  ,          pVe5   V^ 8  d   WPP                  V8  ,          pV# WPP
                  V) 8  ,          pV# )NzInvalid step z. Must be non-negativeT)startstopsteprO   r:   rC   r;   where)r   r$   rS   rT   rU   r>   offset_arraylimit_arrays   &&      r   r5   *GroupByIndexingMixin._make_mask_from_slice   sq   		xxxxq}TF2HIJJ"&<D=ax--499aZ))U22Dax..6$>!CC **eV33D11E9A=L%%(>(>>%!)LK 88K1F1FUL4'1,,Dqy--44  ..4%77r   c                   V ^8  d   QhRR/# r   r   r&   r   )r   s   "r   r   r      s     . .* .r   c                	    \         '       d+   \        \        P                  V 4      pVP	                  4       # T pVP	                  4       # r)   r   r   r   r   _cumcount_arrayr   s   & r   r:   %GroupByIndexingMixin._ascending_count   s>    =6L ++--  L++--r   c                   V ^8  d   QhRR/# r[   r   )r   s   "r   r   r      s     = =: =r   c                	x    \         '       d   \        \        P                  V 4      pMT pVP	                  R R7      # )F)	ascendingr]   r   s   & r   rC   &GroupByIndexingMixin._descending_count   s0    =6LL++e+<<r   r   N)__name__
__module____qualname____firstlineno____doc__r   r!   r?   r6   r/   r1   r5   r:   rC   __static_attributes__r   r   r   r   r       s`     S7 S7j&:8(T . . = =r   r   c                  .    ] tR t^tR R ltR R ltRtR# )r   c                    V ^8  d   QhRRRR/# r   groupby_objectzgroupby.GroupByr   Noner   )r   s   "r   r   &GroupByPositionalSelector.__annotate__        - - -4 -r   c                	    Wn         R # r)   rm   r   rm   s   &&r   __init__"GroupByPositionalSelector.__init__       ,r   c                    V ^8  d   QhRRRR/# )r   r$   r%   r   DataFrame | Seriesr   )r   s   "r   r   ro      s      <  <8  <=O  <r   c                n    V P                   P                  V4      pV P                   P                  V4      # )a<  
Select by positional index per group.

Implements GroupBy._positional_selector

Parameters
----------
arg : PositionalIndexer | tuple
    Allowed values are:
    - int
    - int valued iterable such as list or range
    - slice with step either None or positive
    - tuple of integers and slices

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

See Also
--------
DataFrame.iloc : Integer-location based indexing for selection by position.
GroupBy.head : Return first n rows of each group.
GroupBy.tail : Return last n rows of each group.
GroupBy._positional_selector : Return positional selection for each group.
GroupBy.nth : Take the nth row from each group if n is an int, or a
    subset of rows, if n is a list of ints.
)rm   r?   _mask_selected_objr=   s   && r   __getitem__%GroupByPositionalSelector.__getitem__   s1    > ""EEcJ""55d;;r   rr   N)rd   re   rf   rg   rt   r{   ri   r   r   r   r   r      s    - <  <r   r   c                  B    ] tR tRtRtR R ltRR R lltR R	 ltR
tR# )GroupByNthSelectori   zG
Dynamically substituted for GroupBy.nth to enable both call and index
c                    V ^8  d   QhRRRR/# rl   r   )r   s   "r   r   GroupByNthSelector.__annotate__%  rp   r   c                	    Wn         R # r)   rr   rs   s   &&r   rt   GroupByNthSelector.__init__%  rv   r   Nc               $    V ^8  d   QhRRRRRR/# )r   nr%   dropnazLiteral['any', 'all'] | Noner   rx   r   )r   s   "r   r   r   (  s(     3 3$3 -3 
	3r   c                	8    V P                   P                  W4      # r)   rm   _nth)r   r   r   s   &&&r   __call__GroupByNthSelector.__call__(  s    
 ""''22r   c                    V ^8  d   QhRRRR/# )r   r   r%   r   rx   r   )r   s   "r   r   r   /  s     + +6 +;M +r   c                	8    V P                   P                  V4      # r)   r   )r   r   s   &&r   r{   GroupByNthSelector.__getitem__/  s    ""''**r   rr   r)   )	rd   re   rf   rg   rh   rt   r   r{   ri   r   r   r   r~   r~      s    -3+ +r   r~   )
__future__r   collections.abcr   typingr   r   r   numpyr;   pandas.util._decoratorsr   r	   pandas.core.dtypes.commonr
   r   pandas._typingr   pandasr   r   pandas.core.groupbyr   r   r!   r   r~   r   r   r   <module>r      ss    " $  

 0 ,U= U=p ../$< $< 0$<N+ +r   