+
    xȇi4                         ^ RI Ht ^ RIHt ^ RIt^ RIt^ RIHtH	t	H
t
HtHtHtHtHt ^ RIHt  ! R R4      tR tR tR	 tR
 tR t]P2                  P5                  RRR.4      R 4       tR tR tR tR# )    )product)ascii_lowercaseN)	DataFrameIndex
MultiIndexPeriodSeries	Timedelta	Timestamp
date_rangec                     a ] tR t^t oR tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR t]P,                  P/                  R]! ^^4       U u. uF  p \3        RV R R24      NK  	  up ]! ^^4       U u. uF  p \3        RV R R24      NK  	  up ]! ^^4       U u. uF  p \3        RV R R2RR7      NK  	  up ]! ^^4       Uu. uF  p\5        VRR7      NK  	  up]! ^^4       Uu. uF  p\7        RRVR7      NK  	  up.4      R 4       tR tR  tR! tR"t Vt!R## u up i u up i u up i u upi u upi )$TestCountingc                   \        R .R .R .R.R ..R.R7      pVP                  R4      pVP                  p\        . RO4      p\        P
                  ! WBP                  4       4       \        P
                  ! WCP                  4       4       R# )abAcolumnsNr         r      r   groupbyr   r	   tmassert_series_equalcumcountselfdfgsgexpecteds   &    r/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/groupby/test_counting.pytest_cumcountTestCounting.test_cumcount   sm    usecUSE:SEJJJsOSS/*
x6
x7    c                "   \        4       P                  ^ R7      p\        \        R7      P                  ^ R7      p\        RR7      p\        P
                  ! W1P                  4       4       \        P
                  ! W2P                  4       4       R# r   )leveldtypeint64N)r   r   r	   objectr   r   r   r   gesees   &   r$   test_cumcount_empty TestCounting.test_cumcount_empty   sc    [  q )&!)))2 !
q++-0
q++-0r'   c                @   \        R .R .R .R.R ..R.^ .^,          R7      pVP                  R4      pVP                  p\        . RO^ .^,          R7      p\        P
                  ! WBP                  4       4       \        P
                  ! WCP                  4       4       R# )r   r   r   r   indexr7   Nr   r   r   s   &    r$   test_cumcount_dupe_index%TestCounting.test_cumcount_dupe_index)   s    USEC53%#/#qcAg
 JJsOSS/!q9
x6
x7r'   c                j   \         P                  ! ^ ^.^^.^^.^^.^^ ..4      p\        R.R.R.R.R..R.VR7      pVP                  R4      pVP                  p\        . ROVR7      p\        P                  ! WSP                  4       4       \        P                  ! WTP                  4       4       R# )r   r   r   r   r6   r8   Nr   )	r   from_tuplesr   r   r   r	   r   r   r   r   mir    r!   r"   r#   s   &     r$   test_cumcount_miTestCounting.test_cumcount_mi5   s    ##aVaVaVaVaV$LMusecUSE:SEQSTJJsOSS/4
x6
x7r'   c                D   \        R .R .R .R.R ..R.^ .^,          R7      pVP                  . RO4      pVP                  p\        . RO^ .^,          R7      p\        P
                  ! WBP                  4       4       \        P
                  ! WCP                  4       4       R# )r   r   r   r6   r8   Nr   r   r   r   r   r   r   r   s   &    r$   test_cumcount_groupby_not_col*TestCounting.test_cumcount_groupby_not_col@   s    USEC53%#/#qcAg
 JJ'SS/!q9
x6
x7r'   c                   \        R \        R4      /4      pVP                  R 4      pVP                  p\	        . RO4      p\
        P                  ! WBP                  4       4       \
        P                  ! WCP                  4       4       R# )r   aaabaNrB   r   listr   r   r	   r   r   ngroupr   s   &    r$   test_ngroupTestCounting.test_ngroupL   s]    T']+,JJsOSS/*
x4
x5r'   c                (   \        R \        R4      /4      pVP                  R 4      pVP                  p\	        \        ^4      RR7      p\        P                  ! WBP                  4       4       \        P                  ! WCP                  4       4       R# )r   abcder-   r+   N)	r   rH   r   r   r	   ranger   r   rI   r   s   &    r$   test_ngroup_distinct!TestCounting.test_ngroup_distinctV   sc    T']+,JJsOSS%('2
x4
x5r'   c                    \        R ^ .^,          /4      pVP                  R 4      pVP                  p\        ^ .^,          4      p\        P
                  ! WBP                  4       4       \        P
                  ! WCP                  4       4       R# )r   N)r   r   r   r	   r   r   rI   r   s   &    r$   test_ngroup_one_group"TestCounting.test_ngroup_one_group`   sc    aS1W~&JJsOSS1#'?
x4
x5r'   c                "   \        4       P                  ^ R7      p\        \        R7      P                  ^ R7      p\        RR7      p\        P
                  ! W1P                  4       4       \        P
                  ! W2P                  4       4       R# r)   )r   r   r	   r.   r   r   rI   r/   s   &   r$   test_ngroup_emptyTestCounting.test_ngroup_emptyj   sc    [  q )&!)))2 !
q))+.
q))+.r'   c                    \        R \        R4      /4      p\        \        R4      4      p\        P                  ! VP                  V4      P                  4       VP                  V4      P                  4       4       R# )r   rF   N)r   rH   r	   r   r   r   rI   )r   r    ss   &  r$    test_ngroup_series_matches_frame-TestCounting.test_ngroup_series_matches_framet   sU    T']+,4=!
rzz!}335qyy|7J7J7LMr'   c                >   \        R \        R4      /^ .^,          R7      pVP                  R 4      pVP                  p\	        . RO^ .^,          R7      p\
        P                  ! WBP                  4       4       \
        P                  ! WCP                  4       4       R# r   rF   r8   NrB   rG   r   s   &    r$   test_ngroup_dupe_index#TestCounting.test_ngroup_dupe_indexz   sm    T']+A37;JJsOSS/!q9
x4
x5r'   c                h   \         P                  ! ^ ^.^^.^^.^^.^^ ..4      p\        R\        R4      /VR7      pVP	                  R4      pVP
                  p\        . ROVR7      p\        P                  ! WSP                  4       4       \        P                  ! WTP                  4       4       R# )r   r   rF   r8   NrB   )
r   r<   r   rH   r   r   r	   r   r   rI   r=   s   &     r$   test_ngroup_miTestCounting.test_ngroup_mi   s    ##aVaVaVaVaV$LMT']+26JJsOSS/4
x4
x5r'   c                B   \        R \        R4      /^ .^,          R7      pVP                  . RO4      pVP                  p\	        . RO^ .^,          R7      p\
        P                  ! WBP                  4       4       \
        P                  ! WCP                  4       4       R# r\   rG   r   s   &    r$   test_ngroup_groupby_not_col(TestCounting.test_ngroup_groupby_not_col   sn    T']+A37;JJ'SS/!q9
x4
x5r'   c                r   \        . ROR.R7      pVP                  R.4      p\        . RO4      p\        . R	O4      p\        P                  ! WBP
                  ^,
          V,
          4       \        P                  ! W2P                  RR7      4       \        P                  ! WBP                  RR7      4       R# )
r   r   r   T)	ascendingFN)r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r	   r   r   ngroupsrI   )r   r    r!   rf   
descendings   &    r$   test_ngroup_descending#TestCounting.test_ngroup_descending   s    03%@JJu?+	O,

zIIMY+FG
y((T(*BC
z88e8+DEr'   c                4   \        R R.R R.RR.R R.RR..RR.R7      pVP                  RR.4      pVP                  4       pVP                  4       p\	        . RO4      p\	        . R	O4      p\
        P                  ! W54       \
        P                  ! WF4       R# )
r   xyr   r   Xr   Nr   rB   )r   r   rI   r   r	   r   r   )r   r    r!   g_ngroup
g_cumcountexpected_ngroupexpected_cumcounts   &      r$   test_ngroup_matches_cumcount)TestCounting.test_ngroup_matches_cumcount   s    3Z#sc3Z#sc3ZH#J
 JJSz"88:ZZ\
 1"?3
x9
z=r'   c                   \        \        ^4      ^R7       F  p\        RV/4      pVP                  R.4      p\	        \        V4      4      pV Uu. uF  qTP                  V4      NK  	  pp\        V4       UUu. uF  w  ruVRV P                  V4      NK  	  ppp\        P                  ! VP                  4       \        V4      4       \        P                  ! VP                  4       \        V4      4       K  	  R# u upi u uppi )r   )repeatr   N)r   rN   r   r   sortedsetr7   	enumeratecountr   r   rI   r	   r   )	r   pr    r!   ordervalngroupdi
cumcounteds	   &        r$   test_ngroup_cumcount_pair&TestCounting.test_ngroup_cumcount_pair   s    q!,AC8$B

C5!A3q6NE3451C{{3'1G59B1Fvq!BQ%++c*JF""188:vg?""1::<
1CD -
 6Fs   C>:Dc                   \        R \        P                  P                  ^4      P	                  \        R4      ^d4      /4      pVP                  R VR7      pRVR&   RVR&   \        V4       FP  w  pw  rVWBP                  VP                  R3&   \        VP                  4       F  w  rxWrP                  VR3&   K  	  KR  	  \        P                  ! \        VR,          P                  4      VP                  4       4       \        P                  ! \        VR,          P                  4      VP                  4       4       R# )r   abcdef)sortgroup_idgroup_indexN)r   nprandomdefault_rngchoicerH   r   ry   locr7   r   r   r	   valuesrI   r   )	r   r   r    r!   r   _groupjinds	   &&       r$   "test_ngroup_respects_groupby_order/TestCounting.test_ngroup_respects_groupby_order   s    RYY2215<<T(^SQRSJJsJ&:=&q\MAz./FF5;;
*+#EKK0-.sM)* 1 *
 	vbn&;&;<ahhjI
vb&7&>&>?Nr'   datetimelikez2016-05-02dz 20:09:25+00:00z	 20:09:25UTC)tzh)unit2Wi  )freqyearmonthc                    \        R . RORV/4      pVP                  R 4      P                  4       p\        R^^./RR.R7      pR VP                  n        \
        P                  ! WC4       R# )rl   r   r   rm   r8   N)r   r   r   )r   r   rz   r7   namer   assert_frame_equal)r   r   r    resr#   s   &&   r$   test_count_with_datetimelike)TestCounting.test_count_with_datetimelike   s_     _c<@Ajjo##%cAq6]3*=!
h,r'   c           	     X   \        R \        P                  \        P                  .RRR.R^^./4      pVP                  R R.4      P                  P                  4       p\        . RR... . .R R.R7      p\        . V\        P                  RR7      p\        P                  ! W$RR7       R	# )
r   Br   r   C)levelscodesnames)r7   r,   r   F)check_index_typeN)r   r   nanr   r   rz   r   r	   r-   r   r   )r   r    resultr>   r#   s   &    r$   (test_count_with_only_nans_in_first_group5TestCounting.test_count_with_only_nans_in_first_group   s    bffbff-sS#JaVLMS#J'))//1S#J/BxSzR"BbhhSA
v%Hr'   c           
         \        R . ROR^^\        P                  ^^ ./4      pVP                  R.4      P	                  4       p\        \        . RORR7      R . RO/R7      p\        P                  ! W24       R# )r   r   r   )r7   dataN)r   r   r   r   r   )g        g      @g      @g      @)r   r   r   r   )r   r   r   r   rz   r   r   r   )r   r    r   r#   s   &   r$   4test_count_groupby_column_with_nan_in_groupby_columnATestCounting.test_count_groupby_column_with_nan_in_groupby_column   si    _cAq"&&!Q3GHIjj#%%',37sL>Q
 	h,r'   c                   \        R R^
R7      p\        \        P                  ! ^
4      V\        P                  ! ^
4      .R7      pVP	                  R 4      pVP                  4       p\        \        P                  ! ^
4      \        P                  ! ^
4      V.R7      pVP	                  R 4      pVP                  4       p\        P                  ! WE4       R# )z1/1/20125min)startr   periodsr8   c                 (    V ^,          ^,          ^ 8H  # )r    rl   s   &r$   <lambda>@TestCounting.test_groupby_count_dateparseerror.<locals>.<lambda>       !qAr'   c                 (    V ^ ,          ^,          ^ 8H  # )r   r   r   s   &r$   r   r      r   r'   N)r   r	   r   aranger   rz   r   r   )r   drsergroupedr   r#   s   &     r$   !test_groupby_count_dateparseerror.TestCounting.test_groupby_count_dateparseerror   s    jvrB RYYr]2ryy}*=>++56RYYr]299R="*=>++56==?
v0r'   r   N)"__name__
__module____qualname____firstlineno__r%   r3   r9   r?   rC   rJ   rO   rR   rU   rY   r]   r`   rc   ri   rs   r   r   pytestmarkparametrizerN   r   r
   r   r   r   r   r   __static_attributes____classdictcell__)r   rl   __classdict__s   00@r$   r   r      sl    81
8	8
8666/N666	F>EO [[CHA;O;aY!C89;O=B1a[I[Y!C	23[IGLQPQ{S{!Y!C	2u={S-21a[9[Yqs#[9<A!QKHKqVD2KH	
	-	-I-1 1E PIS9Hs   D)
D.*D3D85D=r   c                  4   \        R \        R4      R\        P                  ! ^4      P	                  R4      /4      p \        ^^.\        RR.R R7      RR7      pV P                  R 4      P                  P                  4       p\        P                  ! W4       R# )	r!   deltaztimedelta64[ns]r   r   r   r7   r   Nabab)r   rH   r   r   astyper	   r   r   r   rz   r   r   )r    r#   r   s      r$   #test_groupby_timedelta_cython_countr     sy    		d8ngryy|':':;L'MN
B q!fE3*3$?gNHZZ_""((*F8,r'   c                     Rp \        RV ^
,          RR7      p\        R\        P                  P	                  ^4      P                  \        \        4      V 4      R\        P                  P	                  ^4      P                  ^ ^V 4      R\        P                  P	                  ^4      P                  V 4      P                  ^4      R\        P                  P	                  ^4      P                  R^
V 4      R\        P                  P	                  ^4      P                  W4      R	\        P                  P	                  ^4      P                  V 4      P                  ^4      R
\        P                  P	                  ^4      P                  V 4      P                  ^4      R\        P                  P	                  ^4      P                  W4      \        P                  P	                  ^4      P                  V^4      ,
          R\        P                  P	                  ^4      P                  \        \        4      V 4      /	4      pVP                  P                  . RO4       FU  p\        P                  VP                  \        P                  P	                  ^4      P                  W ^
,          4      V3&   KW  	  VR,          P                  R4      VR&   RRRR.3 Ff  pVP!                  V4      P#                  4       pVP!                  V4      P%                  \        P"                  4      p\&        P(                  ! WV4       Kh  	  R# )r   z
2015-08-30min)r   r   1st2nd3rd4th5th6th7th8th9thcategoryNi   i)r   r   r   )r   r   r   r   r   r   rH   r   integersstandard_normalroundr   dropr   r   r   r   rz   applyr   r   )nr   r    colkeyleftrights          r$   
test_countr   
  sX   A	L!r'	>B	299((+2243H!L299((+44Q1=299((+;;A>DDQG299((+44S"a@299((+2229299((+;;A>DDQG299((+;;A>DDQG299((+2229ii##A&--b!45299((+2243H!L	

B zz45CE66ryy$$Q'..qr':C?@ 6 5	  ,BuIuuen-zz#$$&

3%%ioo6
d* .r'   c                  Z   \        . R
O^\        P                  R.^\        P                  \        P                  ... ROR7      p V P                  R4      P	                  4       pV P                  RRR7      P	                  4       p\        ^^.^ ^ ..RR.^^.R7      pRVP
                  n        \        P                  ! W#P                  4       4       \        P                  ! W4       V P                  R4      R,          P	                  4       p\        P                  ! WCR,          4       R	# )r   barr   r   r   r   F)as_indexr6   N)r   r   foo)r   r   r   )r   r   r   r   rz   r7   r   r   r   reset_indexr   )r    count_ascount_not_asr#   count_Bs        r$   test_count_non_nullsr   (  s     
	BFFE*Q,?@
B
 zz#$$&H::cE:288:L1a&1a&)C:aVLHHNN,(<(<(>?(-jjoc"((*G7SM2r'   c                  8   \        R R .^,          R.^,          ,           R^.^,          ^.^,          ,           /4      p V P                  R4      P                  P                  4       p\	        ^^.\        ^^.RR7      R R7      p\        P                  ! W4       R# r   r   cr   r   N)r   r   r   rz   r	   r   r   r   r    r   r#   s      r$   test_count_objectr   <  s~    	C#cUQY.aS1WsQw5FG	HBZZ_$$&Fq!fE1a&s$;#FH6,r'   c                  f   \        R R \        P                  \        P                  .R.^,          ,           R^.^,          ^.^,          ,           /4      p V P                  R4      P                  P                  4       p\        ^^.\        ^^.RR7      R R7      p\        P                  ! W4       R# r   )
r   r   r   r   r   rz   r	   r   r   r   r   s      r$   test_count_object_nanr   C  s    	C#rvvrvv.#:C!qA3QR7ARS	TBZZ_$$&Fq!fE1a&s$;#FH6,r'   typr.   float32c                 p   \         P                  ! \         P                  P                  ^4      P	                  ^ ^R4      \         P                  P                  ^4      P	                  ^ ^R4      34      P                  R4      p\        V. R	OR7      p\         P                  W"^8H  &   VP                  RR.4      P                  4       pVR,          P                  V 4      VR&   VR,          P                  V 4      VR&   VP                  RR.4      P                  4       p\        P                  ! WC4       R# )
r   float64r   r   r   dr   N)
   r   )r   r   r   r  )r   hstackr   r   r   r   r   r   r   rz   r   r   )r   valsr    r#   r   s   &    r$   test_count_cross_typer  J  s     99II!!!$--aG<II!!!$--aG<	

 fY 	 
4!5	6B&&BQwKzz3*%++-HgnnS!BsGgnnS!BsGZZc
#))+F&+r'   c                     \        R \        P                  ! . RO\        P                  4      R\        P                  ! . R	O\        P                  4      R\        P                  ! . R
O\        P
                  4      R\        R4      /4      p V P                  R4      P                  4       p\        R ^^.R^^.R^^./\        \        R4      RR7      R7      p\        P                  ! W4       R# )r   r   r   grpabr   r8   N)r   r   r   d   )r   r   r      )      r
     r   )r   r   arrayint8uint32int16rH   r   rz   r   r   r   r   s      r$   test_lower_int_prec_countr  _  s    	."''2,		2,14>		

B ZZ$$&F	q!fcAq63A/uT$Ze7TH &+r'   c                  h  a  ! R  R\         4      o ! V3R lR4      p \        R\        ^4       Uu. uF	  q! 4       NK  	  upR\        R
4      /4      pVP	                  R4      P                  4       p\        R^^./\        \        R4      RR7      R7      p\        P                  ! W44       R	# u upi )c                       ] tR tRtRtR# )Atest_count_uses_size_on_exception.<locals>.RaisingObjectExceptionip  r   N)r   r   r   r   r   r   r'   r$   RaisingObjectExceptionr  p  s    r'   r  c                   P   <a a ] tR tRt oRV3R lV 3R llltV3R ltRtVtV ;t# )8test_count_uses_size_on_exception.<locals>.RaisingObjectis  c                   < V ^8  d   QhRR/# )r   returnNr   )formatr   s   "r$   __annotate__Etest_count_uses_size_on_exception.<locals>.RaisingObject.__annotate__t  s     	 	 	r'   c                0   < \         SV `  4        Wn        R # N)super__init__msg)r   r"  	__class__s   &&r$   r!  Atest_count_uses_size_on_exception.<locals>.RaisingObject.__init__t  s    GHr'   c                (   < S! V P                   4      hr  r"  )r   otherr  s   &&r$   __eq__?test_count_uses_size_on_exception.<locals>.RaisingObject.__eq__x  s    (22r'   r&  )zI will raise inside Cython)	r   r   r   r   r!  r(  r   r   __classcell__)r#  r   r  s   @@r$   RaisingObjectr  s  s     	 		3 	3r'   r+  r   r  r  r   r8   Nr   )		Exceptionr   rN   rH   r   rz   r   r   r   )r+  r   r    r   r#   r  s        @r$   !test_count_uses_size_on_exceptionr-  o  s     3 3 
C58<8a-/8<eT(^T	UBZZ$$&F#1veDJU.KLH&+ =s   B/
c           
         \         P                  ! R 4       \        R. ROR\        . ROV R7      /4      pVP	                  R4      P                  4       p\        R^/\        . RORR7      R7      p\        P                  ! W#4       R# )	pyarrowr   r   r+   r   r8   N)r   r   r   )r   r   r   )	r   importorskipr   r	   r   rz   r   r   r   )any_string_dtyper    r   r#   s   &   r$   test_count_arrow_string_arrayr2    sk    
	"		if_<LMN
B ZZ_""$F#qys)CDH&+r'   )	itertoolsr   stringr   numpyr   r   pandasr   r   r   r   r	   r
   r   r   pandas._testing_testingr   r   r   r   r   r   r   r   r   r  r  r-  r2  r   r'   r$   <module>r9     s     "  	 	 	 j1 j1Z-+<3(-- 9 56, 7,(, ,&,r'   